Code

Also display new created variables
[gosa.git] / plugins / admin / fai / class_faiVariable.inc
index 12f21d978da0f4794bcc24ea28aeb8ae917ad3e6..fa81784ca939f47f4a092eb89600a363000befab 100644 (file)
@@ -85,6 +85,8 @@ class faiVariable extends plugin
         $this->SubObjects[$object['cn'][0]]['status']      = "edited";
         $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
       }
+
+      @log::log("view","fai/".get_class($this),$this->dn);
     }
     $this->ui = get_userinfo();
   }
@@ -210,21 +212,17 @@ class faiVariable extends plugin
     $ret = $this->getList();
     $tmp = array();
     foreach($this->SubObjects as $key => $obj){
-      
       $acl = $ui->get_permissions($obj['dn'],"fai/faiVariableEntry");
-     
-      if(preg_match("/r/",$acl)){
+      if(preg_match("/r/",$acl) || $obj['dn'] == "new"){
         $tmp[$key] = $ret[$key];
       } 
-      
-      $smarty->assign("SubObjects",$tmp);
     }
+    $smarty->assign("SubObjects",$tmp);
 
 
-      /* Magic quotes GPC, escapes every ' " \, to solve some security risks
+    /* Magic quotes GPC, escapes every ' " \, to solve some security risks
      * If we post the escaped strings they will be escaped again
      */
-
     foreach($this->attributes as $attrs){
       if(get_magic_quotes_gpc()){
         $smarty->assign($attrs,htmlentities (stripslashes(utf8_decode($this->$attrs))));
@@ -284,8 +282,9 @@ class faiVariable extends plugin
       if($_SESSION['faifilter']['branch'] == "main"){
         $use_dn = $this->dn;
       }
-
+  
       prepare_to_save_FAI_object($use_dn,array(),true);
+      @log::log("remove","fai/".get_class($this),$use_dn,$this->attributes);
 
       foreach($this->SubObjects as $name => $obj){
         $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
@@ -332,6 +331,12 @@ class faiVariable extends plugin
     $ldap = $this->config->get_ldap_link();
     prepare_to_save_FAI_object($this->dn,$this->attrs);
     show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/variable 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();