From: cajus Date: Thu, 11 May 2006 11:54:21 +0000 (+0000) Subject: Show more specific LDAP errors - part 1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2731357c333228187a504bee9df887dbf18f5538;p=gosa.git Show more specific LDAP errors - part 1 git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3297 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/TODO b/TODO index 0f4f3978e..3b471aad2 100644 --- a/TODO +++ b/TODO @@ -33,7 +33,6 @@ Target for 2.4.1: Now: * evaluate what effects a ldap->cat(..., $this->attributes) will have to other plugins in class_plugin.inc -* Enhance show_ldap_error() with an additional programmer supplied message * Changing LDAP-Servers -> start tab! Actions? diff --git a/include/class_plugin.inc b/include/class_plugin.inc index 69a537cff..654a63896 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -949,7 +949,7 @@ class plugin } $ldap->cd($dn); $ldap->modify($nattrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Handle object tagging failed")); } else { @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not removing tag ($tag) $dn - seems to have moved away", "Tagging"); } diff --git a/plugins/personal/connectivity/class_intranetAccount.inc b/plugins/personal/connectivity/class_intranetAccount.inc index 6b0638ace..d891007ed 100644 --- a/plugins/personal/connectivity/class_intranetAccount.inc +++ b/plugins/personal/connectivity/class_intranetAccount.inc @@ -97,9 +97,9 @@ class intranetAccount extends plugin @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save"); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing intranet account failed")); /* Optionally execute a command after we're done */ $this->postremove(); @@ -152,9 +152,9 @@ $ldap->modify ($this->attrs); $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving intranet account failed")); /* Optionally execute a command after we're done */ $this->postcreate(); diff --git a/plugins/personal/connectivity/class_kolabAccount.inc b/plugins/personal/connectivity/class_kolabAccount.inc index 114444cf9..16e23b9fa 100644 --- a/plugins/personal/connectivity/class_kolabAccount.inc +++ b/plugins/personal/connectivity/class_kolabAccount.inc @@ -320,9 +320,9 @@ class kolabAccount extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving Kolab account failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ diff --git a/plugins/personal/connectivity/class_oxchangeAccount.inc b/plugins/personal/connectivity/class_oxchangeAccount.inc index 77e38efb5..40119ac48 100644 --- a/plugins/personal/connectivity/class_oxchangeAccount.inc +++ b/plugins/personal/connectivity/class_oxchangeAccount.inc @@ -715,16 +715,16 @@ class oxchangeAccount extends plugin if($ldap->dn_exists("ou=addr,".$this->dn)){ $ldap->rmdir_recursive("ou=addr,".$this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing of oxchange addressbook failed")); } $ldap->cd($this->dn); @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save"); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); + show_ldap_error($ldap->get_error(), _("Removing oxchange account failed")); - show_ldap_error($ldap->get_error()); /* Optionally execute a command after we're done */ $this->postremove(); @@ -814,16 +814,16 @@ $ldap->modify ($this->attrs); $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving of oxchange account failed")); /* Optionally execute a command after we're done */ $this->postcreate(); if($needupdate){ $ldap->create_missing_trees("ou=addr,".$this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Creating oxchange addressbook tree failed")); /* Finally save data to postgresql server */ pg_set_client_encoding ("UNICODE"); $nv = "SELECT nextval ('serial_id')"; diff --git a/plugins/personal/connectivity/class_phpgwAccount.inc b/plugins/personal/connectivity/class_phpgwAccount.inc index 2bc1a0c67..b70991a96 100644 --- a/plugins/personal/connectivity/class_phpgwAccount.inc +++ b/plugins/personal/connectivity/class_phpgwAccount.inc @@ -67,9 +67,9 @@ class phpgwAccount extends plugin @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save"); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing PHPgw account failed")); /* Optionally execute a command after we're done */ $this->handle_post_events('remove'); @@ -110,9 +110,9 @@ $ldap->modify ($this->attrs); $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving PHPgw account failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ diff --git a/plugins/personal/connectivity/class_phpscheduleitAccount.inc b/plugins/personal/connectivity/class_phpscheduleitAccount.inc index 5f1e60ffb..63536b2c3 100644 --- a/plugins/personal/connectivity/class_phpscheduleitAccount.inc +++ b/plugins/personal/connectivity/class_phpscheduleitAccount.inc @@ -79,9 +79,8 @@ class phpscheduleitAccount extends plugin @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save"); $this->cleanup(); -$ldap->modify ($this->attrs); - - show_ldap_error($ldap->get_error()); + $ldap->modify ($this->attrs); + show_ldap_error($ldap->get_error(), _("Removing PHPscheduleit account failed")); /* Optionally execute a command after we're done */ $this->handle_post_events('remove'); @@ -120,9 +119,9 @@ $ldap->modify ($this->attrs); $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving PHPscheduleit account failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ diff --git a/plugins/personal/connectivity/class_pptpAccount.inc b/plugins/personal/connectivity/class_pptpAccount.inc index c7ed311e8..04ea2390c 100644 --- a/plugins/personal/connectivity/class_pptpAccount.inc +++ b/plugins/personal/connectivity/class_pptpAccount.inc @@ -79,9 +79,9 @@ class pptpAccount extends plugin @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save"); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing PPTP account failed")); /* Optionally execute a command after we're done */ $this->handle_post_events('remove'); @@ -122,9 +122,9 @@ $ldap->modify ($this->attrs); $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving PPTP account failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ diff --git a/plugins/personal/connectivity/class_proxyAccount.inc b/plugins/personal/connectivity/class_proxyAccount.inc index d439a601e..de1cc587b 100644 --- a/plugins/personal/connectivity/class_proxyAccount.inc +++ b/plugins/personal/connectivity/class_proxyAccount.inc @@ -151,9 +151,9 @@ class proxyAccount extends plugin $this->attributes, "Save"); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing proxy account failed")); /* Optionally execute a command after we're done */ $this->handle_post_events("remove"); @@ -257,10 +257,9 @@ $ldap->modify ($this->attrs); $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving proxy account failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ diff --git a/plugins/personal/connectivity/class_pureftpdAccount.inc b/plugins/personal/connectivity/class_pureftpdAccount.inc index 41dc63e68..aa55f5d26 100644 --- a/plugins/personal/connectivity/class_pureftpdAccount.inc +++ b/plugins/personal/connectivity/class_pureftpdAccount.inc @@ -91,9 +91,9 @@ class pureftpdAccount extends plugin @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save"); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing pureftpd account failed")); /* Optionally execute a command after we're done */ $this->handle_post_events('remove'); @@ -170,9 +170,9 @@ $ldap->modify ($this->attrs); $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving pureftpd account failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ diff --git a/plugins/personal/connectivity/class_webdavAccount.inc b/plugins/personal/connectivity/class_webdavAccount.inc index 7ea80d965..ba0c5ec20 100644 --- a/plugins/personal/connectivity/class_webdavAccount.inc +++ b/plugins/personal/connectivity/class_webdavAccount.inc @@ -63,9 +63,9 @@ class webdavAccount extends plugin @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save"); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing webDAV account failed")); /* Optionally execute a command after we're done */ $this->handle_post_events('remove'); @@ -106,9 +106,9 @@ $ldap->modify ($this->attrs); $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving webDAV account failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc index 6aa840bec..8582fce96 100644 --- a/plugins/personal/environment/class_environment.inc +++ b/plugins/personal/environment/class_environment.inc @@ -713,8 +713,7 @@ class environment extends plugin $this->cleanup(); $ldap->modify ($this->attrs); - - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing environment information failed")); /* Optionally execute a command after we're done */ $this->handle_post_events("remove"); @@ -1045,9 +1044,7 @@ $ldap->modify ($attrs); $ldap->cd($this->dn); $this->cleanup(); $ldap->$mode($this->attrs); - if($ldap->get_error()!="Success"){ - print_red($ldap->get_error()); - } + show_ldap_error($ldap->get_error(), _("Adding environment information failed")); $this->handle_post_events($mode); } diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index e47078544..2141c2ec3 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -541,6 +541,7 @@ class user extends plugin { $ldap= $this->config->get_ldap_link(); $ldap->rmdir ($this->dn); + show_ldap_error($ldap->get_error(), _("Removing generic user account failed")); /* Delete references to groups */ $ldap->cd ($this->config->current['BASE']); @@ -829,7 +830,7 @@ class user extends plugin $this->cleanup(); $ldap->cd ($this->dn); $ldap->$mode ($this->attrs); - if (show_ldap_error($ldap->get_error())){ + if (show_ldap_error($ldap->get_error(), _("Saving generic user account failed"))){ return (1); } diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index 65686eeb4..08abd5fb1 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -567,9 +567,9 @@ class mailAccount extends plugin $this->attributes, "Save"); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing mail account failed")); /* Connect to IMAP server for account deletion */ if ($this->gosaMailServer != ""){ @@ -672,7 +672,7 @@ $ldap->modify ($this->attrs); $this->cleanup(); $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving mail account failed")); /* Only do IMAP actions if we are not a template */ if (!$this->is_template){ diff --git a/plugins/personal/nagios/class_nagiosAccount.inc b/plugins/personal/nagios/class_nagiosAccount.inc index 1afde98f7..fc6e04899 100644 --- a/plugins/personal/nagios/class_nagiosAccount.inc +++ b/plugins/personal/nagios/class_nagiosAccount.inc @@ -142,9 +142,9 @@ class nagiosAccount extends plugin /* Write back to ldap */ $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving nagios account failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ @@ -221,9 +221,9 @@ $ldap->modify ($this->attrs); $this->attributes, "Save"); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing nagios account failed")); /* remove the entry from LDAP */ unset ($this->attrs['uid']); diff --git a/plugins/personal/netatalk/class_netatalk.inc b/plugins/personal/netatalk/class_netatalk.inc index 9c65c8c2e..7e66f6ce8 100644 --- a/plugins/personal/netatalk/class_netatalk.inc +++ b/plugins/personal/netatalk/class_netatalk.inc @@ -253,7 +253,7 @@ class netatalk extends plugin { $this->cleanup(); $ldap->modify($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving Netatalk account failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account) { @@ -313,7 +313,7 @@ class netatalk extends plugin { $this->cleanup(); $ldap->modify($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing Netatalk account failed")); /* remove the entry from LDAP */ unset ($this->attrs['uid']); diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index c61d6252f..47675b503 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -592,9 +592,9 @@ class posixAccount extends plugin $this->attributes, "Save"); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing UNIX account failed")); /* Delete group only if cn is uid and there are no other members inside */ @@ -809,7 +809,7 @@ $ldap->modify ($this->attrs); unset($this->attrs['uid']); $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving UNIX account failed")); /* Remove lock needed for unique id generation */ del_lock ("uidnumber"); diff --git a/plugins/personal/samba/class_sambaAccount.inc b/plugins/personal/samba/class_sambaAccount.inc index e2335cca2..31721d67b 100644 --- a/plugins/personal/samba/class_sambaAccount.inc +++ b/plugins/personal/samba/class_sambaAccount.inc @@ -622,9 +622,9 @@ class sambaAccount extends plugin $this->attributes, "Save"); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing Samba account failed")); /* Optionally execute a command after we're done */ $this->handle_post_events("remove"); @@ -969,9 +969,9 @@ $ldap->modify ($this->attrs); /* Write back to ldap */ $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving Samba account failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){