Code

updated logging
[gosa.git] / plugins / admin / ogroups / class_termgroup.inc
index f803cb85adb6880f89b3fd21abf65925f19665bb..a05c6a1c0de4fbb3195d818ada9e9cd70fd6ec28 100644 (file)
@@ -3,9 +3,6 @@
 class termgroup extends plugin
 {
   /* attribute list for save action */
-  var $attributes= array("gotoMode","gotoSyslogServer", "gotoNtpServer");
-  var $objectclasses= array("gotoWorkstationTemplate");
-
   var $members= array();
 
   var $gotoMode           = "locked";
@@ -25,7 +22,11 @@ class termgroup extends plugin
                             "memcheck"        => "memcheck",
                             "sysinfo"         => "sysinfo");
 
-  var $CopyPasteVars = array("gotoNtpServers","modes","inheritTimeServer");
+  var $attributes     = array("gotoMode","gotoSyslogServer", "gotoNtpServer");
+  var $objectclasses  = array("gotoWorkstationTemplate");
+  var $CopyPasteVars  = array("gotoNtpServers","modes","inheritTimeServer","members");
+  var $view_logged    = FALSE;
+
 
   function termgroup ($config, $dn= NULL, $parent= NULL)
   {
@@ -96,8 +97,6 @@ class termgroup extends plugin
         unset($this->gotoNtpServers[$key]);
       }
     }
-
-
   }
 
   function check()
@@ -105,7 +104,7 @@ class termgroup extends plugin
      /* Call common method to give check the hook */
     $message= plugin::check();
 
-    if ($this->acl_is_createable() && $this->dn == "new"){
+    if (!$this->acl_is_createable() && $this->dn == "new"){
       $message[]= _("You have no permissions to create a workstation on this 'Base'.");
     }
 
@@ -130,6 +129,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());
   }
 
 
@@ -137,7 +137,7 @@ class termgroup extends plugin
   {
     /* Get required informations */
     $og     = $this->parent->by_object['ogroup'];
-    $allobs = $og->allobjects;
+    $allobs = $og->objcache;
 
     /* Get correct value for FAIstate */
     $action = $this->mapActions[$act];
@@ -147,7 +147,7 @@ class termgroup extends plugin
     $ldap->cd ($this->config->current['BASE']);
 
     /* Foreach member of mthis ogroup  ... */
-    foreach($og->mem  as $key ){
+    foreach($og->member  as $key ){
   
       /* check objectClasses and create attributes array */
       $attrs = array("FAIstate"=>$action);  
@@ -166,12 +166,6 @@ class termgroup extends plugin
         $ldap->cd ($key);
         $ldap->modify($attrs);
         show_ldap_error($ldap->get_error(),sprintf(_("Setting action state (FAIstate) failed for object '%s', value was '%s'."),$key,$action));
-        
-        if(!preg_match("/success/i",$ldap->get_error())) {
-          gosa_log("FAILED !! Updating FAIstate to '".$action."' : ".$key);
-        }else{
-          gosa_log("OK.  Updating FAIstate to '".$action."' : ".$key);
-        }
       }
     }
   }
@@ -181,6 +175,10 @@ class termgroup extends plugin
     /* Call parent execute */
     plugin::execute();
 
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      @log::log("view","ogroups/".get_class($this),$this->dn);
+    }
 
     /*************** 
       Handle requested action
@@ -370,6 +368,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");
     }
@@ -384,7 +388,7 @@ class termgroup extends plugin
           "plDescription" => _("System group"),
           "plSelfModify"  => FALSE,
           "plDepends"     => array(),
-          "plPriority"    => 0,
+          "plPriority"    => 5,
           "plSection"     => array("administration"),
           "plCategory"    => array("ogroups"),
           "plProvidedAcls"=> array(