Code

Added acls for printer glpi
[gosa.git] / plugins / admin / systems / class_serverService.inc
index 7f8754d3b84846da65c4a0dbb24c5c9763f7942d..57138cca822a692c1887f988ebdad9f2e9fb58f0 100644 (file)
@@ -189,22 +189,8 @@ class ServerService extends plugin
     $this->divList->execute();
     $list = array();
 
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $ldap->cat($this->dn);
-    
-    if($ldap->count()){
-      $attrs = $ldap->fetch();
-    }else{
-      $attrs = array();
-    }
-
     foreach($this->plugins as $name => $obj){
       if($obj->is_account){
-        $flag = $this->plugins[$name]->StatusFlag;
-        if(isset($attrs[$flag][0])){
-          $this->plugins[$name]->$flag = $attrs[$flag][0];
-        }
         $list[$name] = $this->plugins[$name]->getListEntry(); 
       }
     }
@@ -297,8 +283,20 @@ class ServerService extends plugin
             $this->plugins[$name]->$var = $this->$var;  
           }
         }
-        if($this->plugins[$name]->initially_was_account && $this->plugins[$name]->is_account){
-          $this->plugins[$name]->setStatus($action);
+
+        /* 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{