Code

Added acls for printer glpi
[gosa.git] / plugins / admin / systems / class_workstationGeneric.inc
index 7fc3c74e05e49f2e91010c3c19c48cf0abdf8603..b61573302a721d87d37dca48e8418335b18429c1 100644 (file)
@@ -60,9 +60,9 @@ class workgeneric extends plugin
 
 
 
-  function workgeneric ($config, $dn= NULL)
+  function workgeneric ($config, $dn= NULL, $parent= NULL)
   {
-    plugin::plugin ($config, $dn);
+    plugin::plugin ($config, $dn, $parent);
     $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
 
     /* Read arrays */
@@ -130,11 +130,15 @@ class workgeneric extends plugin
     plugin::execute();
 
     /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
+    if(isset($_POST['modify_state'])){
+      if($this->is_account && $this->acl_is_removeable()){
+        $this->is_account= FALSE;
+      }elseif(!$this->is_account && $this->acl_is_createable()){
+        $this->is_account= TRUE;
+      }
     }
 
-    if (isset($_POST['action'])){
+    if ((isset($_POST['action'])) && ($this->acl_is_writeable("FAIstate"))){
       $cmd= search_config($this->config->data['TABS'], "workgeneric", "ACTIONCMD");
       if ($cmd == ""){
         print_red(_("No ACTIONCMD definition found in your gosa.conf"));
@@ -188,9 +192,9 @@ class workgeneric extends plugin
     /* Base select dialog */
     $once = true;
     foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
+      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){
         $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this);
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
         $this->dialog->setCurrentBase($this->base);
       }
     }
@@ -211,12 +215,12 @@ class workgeneric extends plugin
     }
 
     /* Add new ntp Server to our list */ 
-    if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers']))){
+    if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
       $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
     }
 
     /* Delete selected NtpServer for list of used servers  */
-    if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected']))){
+    if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
       foreach($_POST['gotoNtpServerSelected'] as $name){
         unset($this->gotoNtpServer[$name]);
       }
@@ -240,7 +244,7 @@ class workgeneric extends plugin
 
     $smarty->assign("cn", $this->cn);
     $smarty->assign("l", $this->l);
-    $smarty->assign("bases", $this->config->idepartments);
+    $smarty->assign("bases", $this->get_allowed_bases());
     $smarty->assign("staticAddress", "");
 
     $tmp = array();
@@ -334,10 +338,6 @@ class workgeneric extends plugin
             $this->is_modified= TRUE;
           }
         }
-      }else{
-
-        print_red(sprintf(_("You are not allowed to move this object to '%s'."),LDAP::fix($_POST['base'])));
-        $this->set_acl_base('dummy,'.$this->base);
       }
     }
     $this->netConfigDNS->save_object();
@@ -494,7 +494,8 @@ class workgeneric extends plugin
           "plCategory"    => array("workstation" => array("description"  => _("Workstation"),
                                                           "objectClass"  => "gotoWorkstation")),
           "plProvidedAcls"=> array(
-            "cn"                  => _("Workstation name"), 
+            "cn"                  => _("Workstation name"),
+            "l"                   => _("Location") ,
             "base"                => _("Base") ,
             "gotoMode"            => _("Goto mode"), 
             "gotoSyslogServer"    => _("Syslog server"),