From: cajus Date: Sat, 8 Mar 2008 15:59:37 +0000 (+0000) Subject: Removed show_ldap_error from gosa-core X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4e7e87afae542a936568fb5e9a888e9bd0c65d89;p=gosa.git Removed show_ldap_error from gosa-core git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9466 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/html/password.php b/gosa-core/html/password.php index 1391d03a7..1aecdc429 100644 --- a/gosa-core/html/password.php +++ b/gosa-core/html/password.php @@ -237,7 +237,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['apply'])){ /* Do we need to show error messages? */ if (count ($message) != 0){ /* Show error message and continue editing */ - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); } else { /* Passed quality check, just try to change the password now */ @@ -251,7 +251,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['apply'])){ } if ($output != ""){ $message[]= _("External password changer reported a problem: ".$output); - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); } else { if ($method != ""){ change_password ($ui->dn, $_POST['new_password'], 0, $method); diff --git a/gosa-core/include/class_acl.inc b/gosa-core/include/class_acl.inc index d833d5f52..64f2ab711 100644 --- a/gosa-core/include/class_acl.inc +++ b/gosa-core/include/class_acl.inc @@ -1078,7 +1078,9 @@ class acl extends plugin new log("modify","acls/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } - show_ldap_error($ldap->get_error(), sprintf(_("Saving ACLs with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class())); + } /* Refresh users ACLs */ $ui= get_userinfo(); diff --git a/gosa-core/include/class_ldap.inc b/gosa-core/include/class_ldap.inc index af6fec7a3..742315ad3 100644 --- a/gosa-core/include/class_ldap.inc +++ b/gosa-core/include/class_ldap.inc @@ -632,8 +632,8 @@ class LDAP{ $this->cd($cdn); $this->add($na); - show_ldap_error($this->get_error(), sprintf(_("Creating subtree '%s' failed."),$cdn)); - if (!preg_match('/success/i', $this->error)){ + if (!$this->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($this->get_error(), $cdn, LDAP_ADD, get_class())); return FALSE; } } @@ -1097,7 +1097,11 @@ class LDAP{ $ret = $this->modify($data); } } - show_ldap_error($this->get_error(), sprintf(_("Ldap import with dn '%s' failed."),$dn)); + + if (!$this->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($this->get_error(), $dn, "", get_class())); + } + return($ret); } diff --git a/gosa-core/include/class_msg_dialog.inc b/gosa-core/include/class_msg_dialog.inc index d6bc4f7a6..5fb06268f 100644 --- a/gosa-core/include/class_msg_dialog.inc +++ b/gosa-core/include/class_msg_dialog.inc @@ -93,7 +93,7 @@ class msg_dialog public static function displayChecks($messages) { /* Assemble the message array to a plain string */ - foreach ($message as $error){ + foreach ($messages as $error){ msg_dialog::display(_("Error"), $error, ERROR_DIALOG); } } diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 2e10d7215..72f0f26ae 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -1073,7 +1073,11 @@ class plugin $ldap_to = new LDAP($user,$password, $server); $ldap_to -> cd($snapldapbase); - show_ldap_error($ldap->get_error(), sprintf(_("Saving object snapshot with dn '%s' failed."),$snapldapbase)); + + if (!$ldap_to->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap_to->get_error(), $snapldapbase, "", get_class())); + } + } /* check if the dn exists */ @@ -1119,9 +1123,14 @@ class plugin $ldap_to->create_missing_trees($new_base); $ldap_to->cd($new_dn); $ldap_to->add($target); - - show_ldap_error($ldap->get_error(), sprintf(_("Saving object snapshot with dn '%s' failed."),$new_base)); - show_ldap_error($ldap_to->get_error(), sprintf(_("Saving object snapshot with dn '%s' failed."),$new_base)); + if (!$ldap_to->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap_to->get_error(), $new_dn, LDAP_ADD, get_class())); + } + + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $new_base, "", get_class())); + } + } } @@ -1195,7 +1204,9 @@ class plugin $ldap_to = new LDAP($user,$password, $server); $ldap_to -> cd ($snapldapbase); - show_ldap_error($ldap->get_error(), sprintf(_("Method get available snapshots with dn '%s' failed."),$this->dn)); + if (!$ldap_to->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap_to->get_error(), $snapldapbase, "", get_class())); + } }else{ $ldap_to = $ldap; } @@ -1251,7 +1262,9 @@ class plugin $snapldapbase = $cfg['SNAPSHOT_BASE']; $ldap_to = new LDAP($user,$password, $server); $ldap_to->cd ($snapldapbase); - show_ldap_error($ldap_to->get_error(), sprintf(_("Method get deleted snapshots with dn '%s' failed."),$this->dn)); + if (!$ldap_to->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap_to->get_error(), $snapldapbase, "", get_class())); + } }else{ $ldap_to = $ldap; } @@ -1315,7 +1328,9 @@ class plugin $snapldapbase = $cfg['SNAPSHOT_BASE']; $ldap_to = new LDAP($user,$password, $server); $ldap_to->cd ($snapldapbase); - show_ldap_error($ldap->get_error(), sprintf(_("Restore snapshot with dn '%s' failed."),$snapldapbase)); + if (!$ldap_to->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap_to->get_error(), $snapldapbase, "", get_class())); + } }else{ $ldap_to = $ldap; } @@ -1329,7 +1344,9 @@ class plugin /* Import the given data */ $ldap->import_complete_ldif($data,$err,false,false); - show_ldap_error($ldap->get_error(), sprintf(_("Restore snapshot with dn '%s' failed."),$dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, "", get_class())); + } } diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 81f387e13..3a2968ae7 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -1212,6 +1212,8 @@ function get_base_from_people($dn) function strict_uid_mode() { + global $config; + return !(isset($config->current['STRICT']) && preg_match('/^(no|false)$/i', $config->current['STRICT'])); } diff --git a/gosa-core/include/utils/class_tests.inc b/gosa-core/include/utils/class_tests.inc index 4fa85ce41..4c2d40d5d 100644 --- a/gosa-core/include/utils/class_tests.inc +++ b/gosa-core/include/utils/class_tests.inc @@ -57,8 +57,6 @@ class tests { public static function is_uid($uid) { - global $config; - if ($uid == ""){ return (TRUE); } diff --git a/gosa-core/plugins/admin/acl/class_aclManagement.inc b/gosa-core/plugins/admin/acl/class_aclManagement.inc index b6f97d368..198817bc4 100644 --- a/gosa-core/plugins/admin/acl/class_aclManagement.inc +++ b/gosa-core/plugins/admin/acl/class_aclManagement.inc @@ -395,7 +395,7 @@ class aclManagement extends plugin } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); } } diff --git a/gosa-core/plugins/admin/acl/class_aclRole.inc b/gosa-core/plugins/admin/acl/class_aclRole.inc index 0fca34925..e8297b74f 100644 --- a/gosa-core/plugins/admin/acl/class_aclRole.inc +++ b/gosa-core/plugins/admin/acl/class_aclRole.inc @@ -581,7 +581,9 @@ class aclrole extends acl new log("create","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } - show_ldap_error($ldap->get_error(), sprintf(_("Saving ACLs with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, "", get_class())); + } /* Refresh users ACLs */ $ui= get_userinfo(); @@ -619,7 +621,9 @@ class aclrole extends acl $ldap->rmDir($this->dn); new log("remove","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of aclRole with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, "", get_class())); + } /* Optionally execute a command after we're done */ $this->handle_post_events("remove"); @@ -631,7 +635,9 @@ class aclrole extends acl $og= new ogroup($this->config, $ldap->getDN()); unset($og->member[$this->dn]); $og->save (); - show_ldap_error($ldap->get_error(), sprintf(_("Removing aclRole from objectgroup '%s' failed"), $og->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $og->dn, "", get_class())); + } } } diff --git a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc index e647139ef..fc808e028 100644 --- a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc +++ b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc @@ -186,7 +186,9 @@ class department extends plugin $ldap->cd ($this->dn); $ldap->recursive_remove(); new log("remove","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of department with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class())); + } /* Optionally execute a command after we're done */ $this->handle_post_events('remove'); @@ -359,7 +361,9 @@ class department extends plugin $this->handle_post_events('add'); new log("create","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } - show_ldap_error($ldap->get_error(), sprintf(_("Saving of department with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class())); + } /* The parameter forces only to set must_be_tagged, and don't touch any objects This will be done later */ @@ -652,7 +656,9 @@ class department extends plugin $nattrs['objectClass'][]= "gosaAdministrativeUnitTag"; $ldap->cd($dn); $ldap->modify($nattrs); - show_ldap_error($ldap->get_error(), sprintf(_("Handle object tagging with dn '%s' failed."),$dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, get_class())); + } } else { @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not tagging ($tag) $dn - seems to have moved away", "Tagging"); } @@ -681,7 +687,9 @@ class department extends plugin } $ldap->cd($dn); $ldap->modify($nattrs); - show_ldap_error($ldap->get_error(), sprintf(_("Handle object tagging with dn '%s' failed."),$dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, get_class())); + } } else { @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not removing tag ($tag) $dn - seems to have moved away", "Tagging"); } diff --git a/gosa-core/plugins/admin/departments/class_departmentManagement.inc b/gosa-core/plugins/admin/departments/class_departmentManagement.inc index 74d153078..1d040e268 100644 --- a/gosa-core/plugins/admin/departments/class_departmentManagement.inc +++ b/gosa-core/plugins/admin/departments/class_departmentManagement.inc @@ -317,7 +317,7 @@ class departmentManagement extends plugin } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); } } diff --git a/gosa-core/plugins/admin/groups/class_groupGeneric.inc b/gosa-core/plugins/admin/groups/class_groupGeneric.inc index b4d2ae7cc..ed6f1a28a 100644 --- a/gosa-core/plugins/admin/groups/class_groupGeneric.inc +++ b/gosa-core/plugins/admin/groups/class_groupGeneric.inc @@ -573,7 +573,9 @@ class group extends plugin $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/generic with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class())); + } new log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); @@ -838,7 +840,8 @@ class group extends plugin } $ret= 0; - if ( show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/generic with dn '%s' failed."),$this->dn))){ + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); $ret= 1; } diff --git a/gosa-core/plugins/admin/groups/class_groupManagement.inc b/gosa-core/plugins/admin/groups/class_groupManagement.inc index 23b264a97..a75569115 100644 --- a/gosa-core/plugins/admin/groups/class_groupManagement.inc +++ b/gosa-core/plugins/admin/groups/class_groupManagement.inc @@ -270,7 +270,7 @@ class groupManagement extends plugin } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); } } diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc index c51a95d28..92460840c 100644 --- a/gosa-core/plugins/admin/ogroups/class_ogroup.inc +++ b/gosa-core/plugins/admin/ogroups/class_ogroup.inc @@ -682,7 +682,8 @@ class ogroup extends plugin $this->handle_post_events($mode); $ret= 0; - if (show_ldap_error($ldap->get_error(), sprintf(_("Saving of object group/generic with dn '%s' failed."),$this->dn))){ + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); $ret= 1; } @@ -695,7 +696,9 @@ class ogroup extends plugin $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/generic with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); + } new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); diff --git a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc index 67d092a38..413cd2eee 100644 --- a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc @@ -421,7 +421,7 @@ class ogroupManagement extends plugin } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); } } diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc index 1dfb05833..f38de9507 100644 --- a/gosa-core/plugins/admin/users/class_userManagement.inc +++ b/gosa-core/plugins/admin/users/class_userManagement.inc @@ -251,7 +251,7 @@ class userManagement extends plugin if (count($message) != 0){ /* Show error message and continue editing */ - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); return($smarty->fetch(get_template_path('password.tpl', TRUE))); } @@ -541,10 +541,8 @@ class userManagement extends plugin $ldap = $this->config->get_ldap_link(); $ldap->cd($val['dn']); $ldap->modify($attrs); - if($locked){ - show_ldap_error($ldap->get_error(),_("Could not set user status from locked to unlocked.")); - }else{ - show_ldap_error($ldap->get_error(),_("Could not set user status from unlocked to locked.")); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $val['dn'], 0, get_class())); } } } @@ -679,7 +677,7 @@ class userManagement extends plugin } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); } } @@ -743,7 +741,7 @@ class userManagement extends plugin /* Show error message / continue editing */ if (count($message) > 0){ - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); foreach(array("sn", "givenName", "uid", "template") as $attr){ if(isset($_POST[$attr])){ @@ -830,7 +828,7 @@ class userManagement extends plugin /* Show error message / continue editing */ if (count($message) > 0){ - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); } else { $attributes= array('sn' => $this->sn, 'givenName' => $this->givenName); if (isset($this->config->current['IDGEN']) && diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc index c7dd82b70..ab72dfd59 100644 --- a/gosa-core/plugins/personal/generic/class_user.inc +++ b/gosa-core/plugins/personal/generic/class_user.inc @@ -667,7 +667,9 @@ class user extends plugin /* Remove user */ $ldap= $this->config->get_ldap_link(); $ldap->rmdir ($this->dn); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/generic account with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class())); + } new log("remove","users/".get_class($this),$this->dn,$this->attributes,$ldap->get_error()); @@ -1003,7 +1005,8 @@ class user extends plugin $ldap->cd ($this->dn); $ldap->$mode ($this->attrs); - if (show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/generic account with dn '%s' failed."),$this->dn))){ + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class())); return (1); } diff --git a/gosa-core/plugins/personal/generic/main.inc b/gosa-core/plugins/personal/generic/main.inc index fbfcb823e..f1afbfa12 100644 --- a/gosa-core/plugins/personal/generic/main.inc +++ b/gosa-core/plugins/personal/generic/main.inc @@ -91,7 +91,7 @@ if (!$remove_lock){ if (count($message) != 0){ /* Show error message and continue editing */ - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); $display.= $smarty->fetch(get_template_path('password.tpl', TRUE)); return ($display); } @@ -133,7 +133,7 @@ if (!$remove_lock){ } else { /* Errors found, show message */ - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); } } diff --git a/gosa-core/plugins/personal/posix/class_posixAccount.inc b/gosa-core/plugins/personal/posix/class_posixAccount.inc index 995a66a63..c50bf1f8e 100644 --- a/gosa-core/plugins/personal/posix/class_posixAccount.inc +++ b/gosa-core/plugins/personal/posix/class_posixAccount.inc @@ -659,7 +659,9 @@ class posixAccount extends plugin new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/posix account with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class())); + } /* Delete group only if cn is uid and there are no other members inside */ @@ -923,7 +925,9 @@ class posixAccount extends plugin new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } - show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/posix account with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class())); + } /* Remove lock needed for unique id generation */ del_lock ("uidnumber"); diff --git a/gosa-core/plugins/personal/posix/main.inc b/gosa-core/plugins/personal/posix/main.inc index 243644bc7..73396471e 100644 --- a/gosa-core/plugins/personal/posix/main.inc +++ b/gosa-core/plugins/personal/posix/main.inc @@ -82,7 +82,7 @@ if (!$remove_lock){ session::un_set ('posixAccount'); } else { /* Errors found, show message */ - msgDialog::displayChecks($message); + msg_dialog::displayChecks($message); } } diff --git a/gosa-core/setup/class_setupStep_Migrate.inc b/gosa-core/setup/class_setupStep_Migrate.inc index 20d563b5f..cef6eefed 100644 --- a/gosa-core/setup/class_setupStep_Migrate.inc +++ b/gosa-core/setup/class_setupStep_Migrate.inc @@ -1916,7 +1916,9 @@ class Step_Migrate extends setup_step msg_dialog::display(_("LDAP error"), sprintf(_("Copy '%s' to '%s' failed:")."

%s", LDAP::fix($source), LDAP::fix($destination), $ldap->get_error()), ERROR_DIALOG); }else{ $res = $ldap->rmDir($source); - show_ldap_error($ldap->get_error(),_("Problem copying DNs")); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $source, LDAP_DEL, get_class())); + } /* Object is copied, so update its references */ foreach($ogs_to_fix as $dn => $data){