From: hickert Date: Wed, 20 Oct 2010 09:01:01 +0000 (+0000) Subject: Updated ldap export X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=dbfa757f7c785a8ad7768ce9feffd553284290b3;p=gosa.git Updated ldap export -Added error handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20096 594d385d-05f5-0310-b6e9-bd551577e9d8 --- 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))); }