Code

Added acls for printer glpi
[gosa.git] / plugins / admin / departments / class_departmentGeneric.inc
index 58052612ea5b0f281e1bae3784d34cbbd7f022c0..3b6daee52d8093460ba9b38e69918c1bd64a7a11 100644 (file)
@@ -101,20 +101,12 @@ class department extends plugin
       $smarty->assign($name."ACL",$this->getacl($name));
     }
 
-    /* Get bases */
-    $ui = get_userinfo();
-    $check = $ui->get_module_departments("groups");
-    $bases = array();
-    foreach($check as $dn_allowed){
-      $bases[$dn_allowed] = $this->config->idepartments[$dn_allowed];
-    }
-
                /* 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_moveable())){
                                $once = false;
-                               $this->dialog = new baseSelectDialog($this->config,$this,$bases);
+                               $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
                                $this->dialog->setCurrentBase($this->base);
                        }
                }
@@ -135,6 +127,7 @@ class department extends plugin
                }
 
                /* Hide all departments, that are subtrees of this department */
+    $bases = $this->get_allowed_bases();
                if(($this->dn == "new")||($this->dn == "")){
                        $tmp = $bases;
                }else{
@@ -227,7 +220,7 @@ class department extends plugin
 
                /* Permissions for that base? */
                //      $this->dn= "ou=$this->ou,".$this->base;
-               if (chkacl($this->acl, "create") != ""){
+               if ($this->acl_is_createable() && $this->dn == "new"){
                        $message[]= _("You have no permissions to create a department on this 'Base'.");
                }
 
@@ -546,6 +539,7 @@ class department extends plugin
                   "plProvidedAcls" => array(
                     "description"       => _("Description"),
                     "c"                 => _("Country"),
+                    "base"              => _("Base"),
                     "l"                 => _("Location"),
                     "telephoneNumber"   => _("Telephone"),
                     "ou"                => _("Department name"),