From: hickert Date: Fri, 11 May 2007 13:38:10 +0000 (+0000) Subject: Added new logging method to users/posix users/environment X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e58dc1054463b4126bbb430369f5ac1d4e3fbb25;p=gosa.git Added new logging method to users/posix users/environment git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6363 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc index f69065f39..0f3d93059 100644 --- a/plugins/personal/environment/class_environment.inc +++ b/plugins/personal/environment/class_environment.inc @@ -81,6 +81,11 @@ class environment extends plugin { plugin::plugin ($config, $dn); + if($this->is_account){ + @log::log("view","users/environment",$this->dn); + } + + /* Setting uid to default */ if(isset($this->attrs['uid'][0])){ $this->uid = $this->attrs['uid'][0]; @@ -933,6 +938,7 @@ class environment extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("remove","users/environment",$this->dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/environment account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -1186,6 +1192,13 @@ class environment extends plugin $ldap->cd($this->dn); $this->cleanup(); $ldap->$mode($this->attrs); + + if($mode == "modify"){ + @log::log("modify","users/environment",$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/environment",$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/environment account with dn '%s' failed."),$this->dn)); $this->handle_post_events($mode,array("uid"=>$this->uid)); } diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 924b7cf8b..71e11b99f 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -113,8 +113,6 @@ class user extends plugin $this->attributes=array_merge($this->attributes,$this->govattrs); } - @log::log("view","users/user",$dn); - /* Load base attributes */ plugin::plugin ($config, $dn); @@ -138,6 +136,8 @@ class user extends plugin /* Create me for new accounts */ if ($dn == "new"){ $this->is_account= TRUE; + }else{ + @log::log("view","users/user",$dn); } /* Make hash default to md5 if not set in config */ @@ -591,7 +591,9 @@ class user extends plugin $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)); - + + @log::log("remove","users/user",$dn,$this->attributes,$ldap->get_error()); + /* Delete references to groups */ $ldap->cd ($this->config->current['BASE']); $ldap->search ("(&(objectClass=posixGroup)(memberUid=".$this->uid."))", array("uid")); @@ -938,10 +940,14 @@ 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))){ - @log::log("modify","users/user",$this->dn,array_keys($this->attrs),$ldap->get_error()); return (1); } - @log::log("modify","users/user",$this->dn,array_keys($this->attrs),$ldap->get_error()); + + if($mode == "modify"){ + @log::log("modify","users/user",$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/user",$this->dn,array_keys($this->attrs),$ldap->get_error()); + } /* Remove cert? For some reason, the 'ldap' class doesn't want to remove binary entries, so I need diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index 6668f1cbb..4dece52c5 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -96,6 +96,10 @@ class posixAccount extends plugin $ldap= $this->config->get_ldap_link(); + if($this->is_account){ + @log::log("view","users/posix",$this->dn); + } + if ($dn != NULL){ /* Correct is_account. shadowAccount is not required. */ @@ -611,6 +615,8 @@ class posixAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("remove","users/posix",$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)); /* Delete group only if cn is uid and there are no other @@ -848,6 +854,8 @@ class posixAccount extends plugin unset($this->attrs['uid']); $ldap->modify ($this->attrs); + @log::log("modify","users/posix",$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)); /* Remove lock needed for unique id generation */