Code

Added new logging method to users/posix users/environment
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 11 May 2007 13:38:10 +0000 (13:38 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 11 May 2007 13:38:10 +0000 (13:38 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6363 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_environment.inc
plugins/personal/generic/class_user.inc
plugins/personal/posix/class_posixAccount.inc

index f69065f399e3fbd9b06b6b8e4004a3e1bc1e2150..0f3d93059edbc5011c79b74757ac1017b77190bb 100644 (file)
@@ -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));
   }
index 924b7cf8bbc3f264b64cb4ca8bf34ce3354557d6..71e11b99f5316cc869345ee577cebd776844686a 100644 (file)
@@ -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
index 6668f1cbbcd8c04801f0351674095f54b5ecdb5c..4dece52c5e6bcec4366630c972fb3a61207c855c 100644 (file)
@@ -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 */