Code

Added acls for printer glpi
[gosa.git] / plugins / admin / systems / class_serverService.inc
index 8f1058a9216942844c60daa40ac5e1f940cfaf25..57138cca822a692c1887f988ebdad9f2e9fb58f0 100644 (file)
@@ -31,6 +31,7 @@ class ServerService extends plugin
   var $current          = "";
   var $backup           = NULL;
   var $acl              ;
+  var $cn;
 
   function ServerService ($config, $dn)
   {
@@ -187,9 +188,10 @@ class ServerService extends plugin
     /* Dispaly services overview */
     $this->divList->execute();
     $list = array();
+
     foreach($this->plugins as $name => $obj){
       if($obj->is_account){
-        $list[$name] = $obj->getListEntry(); 
+        $list[$name] = $this->plugins[$name]->getListEntry(); 
       }
     }
     $this->divList -> setEntries($list);
@@ -273,13 +275,36 @@ class ServerService extends plugin
       return;
     }
     
+    $caseVars = array("cn","dn");
     if($service == ALL_SERVICES){
       foreach($this->plugins as $name => $obj){
-        if($this->plugins[$name]->initially_was_account && $this->plugins[$name]->is_account){
-          $this->plugins[$name]->setStatus($action);
+        foreach($caseVars as $var){
+          if(isset($this->$var)){
+            $this->plugins[$name]->$var = $this->$var;  
+          }
+        }
+
+        /* check if services can be restarted */
+        $map =array(SERVICE_STARTED=> "AllowStart" ,
+                    SERVICE_STOPPED => "AllowStop",
+                    SERVICE_RESTARTED => "AllowRestart");
+
+        /* get plugins informations, restart/start/stop actions allowed ?*/
+        $tmp = $this->plugins[$name]->getListEntry();
+
+        /* Check if given action is allowed for this service */
+        if($tmp[$map[$action]]){
+          if($this->plugins[$name]->initially_was_account && $this->plugins[$name]->is_account){
+            $this->plugins[$name]->setStatus($action);
+          }
         }
       }
     }else{
+      foreach($caseVars as $var){
+        if(isset($this->$var)){
+          $this->plugins[$service]->$var = $this->$var;  
+        }
+      }
       if($this->plugins[$service]->is_account){
         $this->plugins[$service]->setStatus($action);
       }