Code

Added some logging
[gosa.git] / plugins / admin / fai / class_faiScript.inc
index 20779ea1ba8f2a1da9a55a698520797265ed6049..edb3a03c8f25c5a2dd521abfc325d9f6559ed1af 100644 (file)
@@ -84,6 +84,8 @@ class faiScript extends plugin
         $objects                = $this->get_object_attributes($objects,$this->subAttributes);
         $this->SubObjects[$objects['cn']] = $objects;
       }
+    
+      @log::log("view","fai/".get_class($this),$this->dn);
     }
     $this->ui = get_userinfo();
   }
@@ -195,7 +197,8 @@ class faiScript extends plugin
         /* Check acls, are we allowed to delete an entry */
         $acl = $this->ui->get_permissions($this->acl_base_for_current_object($this->SubObjects[$entry]['dn']),"fai/faiScriptEntry")  ;
         if(preg_match("/d/",$acl)){
-          if(($this->SubObjects[$entry]['status'] == "edited")||($this->SubObjects[$entry]['status'] == "FreshLoaded")){
+          $status = $this->SubObjects[$entry]['status'];
+          if($status == "edited" || $status == "FreshLoaded"){
             $this->SubObjects[$entry]['status']= "delete";
           }else{
              unset($this->SubObjects[$entry]);
@@ -382,7 +385,9 @@ class faiScript extends plugin
       if($_SESSION['faifilter']['branch'] == "main"){
         $use_dn = $this->dn;
       }
-    
+   
+      @log::log("remove","fai/".get_class($this),$use_dn,$this->attributes);
       prepare_to_save_FAI_object($use_dn,array(),true);
       
       foreach($this->SubObjects as $name => $obj){
@@ -432,6 +437,12 @@ class faiScript extends plugin
     prepare_to_save_FAI_object($this->dn,$this->attrs);
     show_ldap_error($ldap->get_error(), sprintf(_("Creating of FAI/script with dn '%s' failed."),$this->dn));
 
+    if($this->initially_was_account){
+      @log::log("modify","fai/".get_class($this),$this->dn,$this->attributes);
+    }else{
+      @log::log("create","fai/".get_class($this),$this->dn,$this->attributes);
+    }
+
     /* Do object tagging */
     $this->handle_object_tagging();