Code

Added logging
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 16 May 2007 09:47:38 +0000 (09:47 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 16 May 2007 09:47:38 +0000 (09:47 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6392 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/departments/class_departmentGeneric.inc
plugins/admin/departments/class_departmentManagement.inc
plugins/admin/groups/class_groupApplication.inc
plugins/admin/groups/class_groupGeneric.inc
plugins/admin/groups/class_groupMail.inc
plugins/personal/environment/class_environment.inc

index da4c101b7beeccfc97adc50480725de7ff16889c..9f96a555aeb09652d543a93690cac61b3d7d7728 100644 (file)
@@ -90,6 +90,10 @@ class department extends plugin
                        $this->is_administrational_unit= true;
       $this->initially_was_tagged = true;
                }
+
+    if($this->is_account && $dn != "new"){
+      @log::log("view","department/".get_class($this),$this->dn);
+    }
        }
 
        function execute()
@@ -187,6 +191,7 @@ class department extends plugin
                $ldap= $this->config->get_ldap_link();
                $ldap->cd ($this->dn);
                $ldap->recursive_remove();
+    @log::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));
 
                /* Optionally execute a command after we're done */
@@ -356,14 +361,17 @@ class department extends plugin
                $a= $ldap->fetch();
                $ldap->cd($this->dn);
 
+      print_a(debug_backtrace());
+
                if (count($a)){
                        $this->cleanup();
                        $ldap->modify ($this->attrs); 
-
+      @log::log("modify","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
                        $this->handle_post_events('modify');
                } else {
                        $ldap->add($this->attrs);
                        $this->handle_post_events('add');
+      @log::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));
 
index 3524b15f436149ef3227832f29e8d77312255f9a..a6e2fd9027d6ec572dfb80ede7dfbc57d7ec1ec1 100644 (file)
@@ -238,6 +238,7 @@ class departmentManagement extends plugin
         } else {
           add_lock ($this->dn, $this->ui->dn);
           $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), @LDAP::fix($this->dn)));
+          $smarty->assign("multiple", false);
           $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE));
           return ($display);
         }
index e883208da6b3dc2cc3fcef5e3f264cd4a85d2f60..b66f40e85ddb5c5ea2e86062735be8bc845e06d0 100644 (file)
@@ -156,6 +156,10 @@ class appgroup extends plugin
       $this->InitialFAIrelease  = $this->FAIrelease;
       $this->Releases           = $this->getReleases();
     }
+
+    if($this->is_account){
+      @log::log("view","groups/".get_class($this),$this->dn);
+    }
   }
 
 
@@ -912,7 +916,7 @@ class appgroup extends plugin
     $this->cleanup();
     
     $ldap->modify ($this->attrs); 
-
+    @log::log("remove","group/".get_class($this),$use_dn,array_keys($this->attrs),$ldap->get_error());
     show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/applications with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
@@ -966,6 +970,12 @@ class appgroup extends plugin
     $this->cleanup();
     $ldap->modify ($this->attrs); 
 
+    if($this->initially_was_account){
+      @log::log("modify","group/".get_class($this),$use_dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      @log::log("create","group/".get_class($this),$use_dn,array_keys($this->attrs),$ldap->get_error()); 
+    }   
+
     show_ldap_error($ldap->get_error(), sprintf(_("Saving of groups/applications with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
index 1d2bc1b75ccb96c2efc81d154ecad30755b44c49..aa5ed9884a639f4df59d1188a36a8f49eee1bfb9 100644 (file)
@@ -171,6 +171,10 @@ class group extends plugin
       $this->base =preg_replace ("/^[^,]+,".normalizePreg(get_groups_ou())."/","",$this->dn);
     }
 
+    if($this->dn != "new"){
+      @log::log("view","groups/".get_class($this),$this->dn);
+    }
+
     /* This is always an account */
     $this->is_account= TRUE;
     $this->reload();
@@ -514,6 +518,8 @@ class group extends plugin
     $ldap->rmdir($this->dn);
     show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/generic with dn '%s' failed."),$this->dn));
 
+    @log::log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
     $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
@@ -738,6 +744,12 @@ class group extends plugin
     $this->cleanup();
     $ldap->$mode($this->attrs);
 
+    if($this->initially_was_account){
+      @log::log("modify","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      @log::log("create","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
     $ret= 0;
     if ( show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/generic with dn '%s' failed."),$this->dn))){
       $ret= 1;
index a3c43e5d5a1a20046d93b715f34a770e86798c98..3c9b0feffb369c1ad201a6771a7b58cd39a4edf0 100644 (file)
@@ -292,6 +292,10 @@ class mailgroup extends plugin
     $this->perms["lrswipcd"]= _("write");
     $this->perms["lrswipcda"]= _("admin");
     $this->perms[""]= _("none");
+    
+    if($this->is_account){
+      @log::log("view","groups/".get_class($this),$this->dn);
+    }
   }
 
   function execute()
@@ -643,6 +647,10 @@ class mailgroup extends plugin
   /* remove object from parent */
   function remove_from_parent()
   {
+    if(!$this->initially_was_account){
+      return;
+    }
+  
     /* Added these ObjectClass and Attributes, because they were not 
        removed correctly, only in case of kolab ... 
      */
@@ -680,6 +688,9 @@ class mailgroup extends plugin
     $ldap->modify ($this->attrs); 
     show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/mail with dn '%s' failed."),$this->dn));
 
+
+    @log::log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
     /* Optionally execute a command after we're done */
     $this->handle_post_events("remove");
   }
@@ -875,6 +886,13 @@ I: Only insider delivery */
     $this->cleanup();
     $ldap->modify ($this->attrs); 
     show_ldap_error($ldap->get_error(), sprintf(_("Saving of groups/mail with dn '%s' failed."),$this->dn));
+    
+    if($this->initially_was_account){
+      @log::log("modify","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      @log::log("create","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());  
+    }
+    
 
     /* Optionally execute a command after we're done */
     if ($this->initially_was_account == $this->is_account){
index f8ad1f0b1127c2654d30b16d5112bbec8519d13a..7c18c08ef1408d46254791dac8c6d4b90302679e 100644 (file)
@@ -81,11 +81,6 @@ 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];
@@ -240,6 +235,14 @@ class environment extends plugin
     $this->gotoShareSelections= $config->getShareList(true);
     $this->gotoAvailableShares= $config->getShareList(false);  
 
+    if($this->is_account){
+
+      if(in_array("gosaAccount",$this->attrs['objectClass'])){
+        @log::log("view","users/".get_class($this),$this->dn);
+      }else{
+        @log::log("view","groups/".get_class($this),$this->dn);
+      }
+    }
   }
 
 
@@ -938,7 +941,12 @@ class environment extends plugin
     $this->cleanup();
     $ldap->modify ($this->attrs); 
 
-    @log::log("remove","users/environment",$this->dn,array_keys($this->attrs),$ldap->get_error());
+    if($this->is_group){
+      @log::log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      @log::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/environment account with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
@@ -1193,11 +1201,16 @@ class environment extends plugin
     $this->cleanup();
     $ldap->$mode($this->attrs);
 
+    $cat = "users";
+    if($this->is_group){
+      $cat = "groups";
+    }
+
     /* Log last action */ 
     if($this->initially_was_account){
-      @log::log("modify","users/environment",$this->dn,array_keys($this->attrs),$ldap->get_error());
+      @log::log("modify",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
     }else{
-      @log::log("create","users/environment",$this->dn,array_keys($this->attrs),$ldap->get_error());
+      @log::log("create",$cat."/".get_class($this),$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));