Code

Added logging to ogroup
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 16 May 2007 10:22:20 +0000 (10:22 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 16 May 2007 10:22:20 +0000 (10:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6395 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/ogroups/class_mailogroup.inc
plugins/admin/ogroups/class_ogroup.inc
plugins/admin/ogroups/class_phonequeue.inc
plugins/admin/ogroups/class_termgroup.inc

index 769b913cf4193170f7bb0a6a862065c0996f2980..7ffe77da6a51dcefd57e6dddbdb62ee81db170fd 100644 (file)
@@ -21,6 +21,10 @@ class mailogroup extends plugin
 
     /* Save initial account state */
     $this->initially_was_account= $this->is_account;
+    
+    if($this->is_account){
+      @log::log("view","ogroups/".get_class($this),$this->dn);
+    }
   }
 
 
@@ -103,6 +107,12 @@ class mailogroup extends plugin
     $this->cleanup();
     $ldap->modify ($this->attrs); 
 
+    if($this->initially_was_account){
+      @log::log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      @log::log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
     show_ldap_error($ldap->get_error(), sprintf(_("Saving of object group/mail with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
@@ -136,6 +146,8 @@ class mailogroup extends plugin
     $this->cleanup();
     $ldap->modify ($this->attrs); 
 
+    @log::log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
     show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/mail with dn '%s' failed."),$this->dn));
   }
 
index 09219dfe133e003c678d6b69c2caa1c3cd93d296..9a17773cf9b5b0c996925d1bed337e7bffcb800d 100644 (file)
@@ -94,6 +94,10 @@ class ogroup extends plugin
       $this->base= preg_replace("/^[^,]+,".get_groups_ou()."/","",$this->dn);
     }
 
+    if($this->is_account){
+      @log::log("view","ogroup/".get_class($this),$this->dn);
+    }
+
     /* Load member data */
     $this->reload();
   }
@@ -636,6 +640,7 @@ class ogroup extends plugin
         $this->attrs['member']= array();
       }
       $mode= "modify";
+
     } else {
       $mode= "add";
       $ldap->cd($this->config->current['BASE']);
@@ -647,6 +652,12 @@ class ogroup extends plugin
     $this->cleanup();
     $ldap->$mode($this->attrs);
 
+    if($mode == "add"){
+      @log::log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      @log::log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
     /* Trigger post signal */
     $this->handle_post_events($mode);
 
@@ -666,6 +677,8 @@ class ogroup extends plugin
     $ldap->rmdir($this->dn);
     show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/generic with dn '%s' failed."),$this->dn));
 
+    @log::log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
     /* Trigger remove signal */
     $this->handle_post_events("remove");
   }
index 6355f05b7d771996d20c55c19ff707cbefea4762..c47bd3ce3d1244315d54209e8d2ab2b371e4d867 100644 (file)
@@ -135,6 +135,10 @@ class phonequeue extends plugin
     $this->goFonQueueStrategy= $tmp[$this->goFonQueueStrategy];
     $this->old_cn = $this->cn;
     $this->old_phone_numbers = $this->telephoneNumber;
+  
+    if($this->is_account){
+      @log::log("view","ogroups/".get_class($this),$this->dn);
+    }
   }
 
 
@@ -827,6 +831,12 @@ class phonequeue extends plugin
     $this->cleanup();
     $ldap->modify ($this->attrs); 
 
+    if($this->initially_was_account){
+      @log::log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      @log::log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
     show_ldap_error($ldap->get_error(), _("Saving phone queue failed"));
 
     /* Optionally execute a command after we're done */
@@ -879,6 +889,7 @@ class phonequeue extends plugin
     $ldap->cd($this->dn);
     $this->cleanup();
     $ldap->modify ($this->attrs); 
+    @log::log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
     show_ldap_error($ldap->get_error(), _("Removing phone queue failed"));
   }
 
index 3d9a69b5603c6b336972758f9925f25318a577a9..ece1d495c816a8d60e109106b9ecb940645fb0ea 100644 (file)
@@ -96,7 +96,9 @@ class termgroup extends plugin
       }
     }
 
-
+    if($this->is_account){
+      @log::log("view","ogroups/".get_class($this),$this->dn);
+    }
   }
 
   function check()
@@ -129,6 +131,7 @@ class termgroup extends plugin
     $ldap->cd($this->orig_dn);
     $ldap->modify($this->attrs);
     $this->handle_post_events("remove");
+    @log::log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
   }
 
 
@@ -369,6 +372,12 @@ class termgroup extends plugin
     $this->cleanup();
     $ldap->modify ($this->attrs);
 
+    if($this->initially_was_account){
+      @log::log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      @log::log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
     if(!$this->didAction){
       $this->handle_post_events("modify");
     }