From dbfa757f7c785a8ad7768ce9feffd553284290b3 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 20 Oct 2010 09:01:01 +0000 Subject: [PATCH] Updated ldap export -Added error handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20096 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../addons/ldapmanager/class_export.inc | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/gosa-plugins/ldapmanager/addons/ldapmanager/class_export.inc b/gosa-plugins/ldapmanager/addons/ldapmanager/class_export.inc index ee057e6bc..b541b5214 100644 --- a/gosa-plugins/ldapmanager/addons/ldapmanager/class_export.inc +++ b/gosa-plugins/ldapmanager/addons/ldapmanager/class_export.inc @@ -84,17 +84,32 @@ class ldifexport extends plugin } if(!empty($dn)){ + // Check permissions before sending the output if(!preg_match("/r/",$acls)){ msg_dialog::display(_("Permission error"), sprintf(_("You have no permission to export %s!"), bold(LDAP::fix($dn))), ERROR_DIALOG); }else{ - $data = $ldap->generateLdif(LDAP::fix($dn), 'objectClass=*',$scope); - send_binary_content($data,$name); + + // Check permissions before sending the output + if(!preg_match("/r/",$acls)){ + msg_dialog::display(_("Permission error"), + sprintf(_("You have no permission to export %s!"), bold(LDAP::fix($dn))), + ERROR_DIALOG); + }else{ + $data = $ldap->generateLdif(LDAP::fix($dn), 'objectClass=*',$scope); + if($data === NULL){ + msg_dialog::display(_("Error"), + sprintf(_("Failed to generate ldap export, error was '%s'!"), $ldap->get_error()), + ERROR_DIALOG); + }else{ + send_binary_content($data,$name); + } + } } } - + // Show the main form return ($smarty->fetch (get_template_path('contentexport.tpl', TRUE))); } -- 2.30.2