Code

Avoid PHP warnings
[gosa.git] / gosa-core / include / class_acl.inc
index c79a7f2876dd4fa1344e67d1abbfa47127236b95..a8c944033ec51c7f7b02938a86f2d1b70c3c3bda 100644 (file)
@@ -495,8 +495,8 @@ class acl extends plugin
         $field2= array("string" => $link);
 
         if($this->acl_is_writeable("")){
-          $action.= image('images/lists/sort-up.png', 'sortup_'.$key);
-          $action.= image('images/lists/sort-down.png', 'sortdown_'.$key);
+          $action.= image('images/lists/sort-up.png', 'sortup_'.$key,"","top");
+          $action.= image('images/lists/sort-down.png', 'sortdown_'.$key,"","bottom");
         } 
     
         if($this->acl_is_readable("")){
@@ -518,6 +518,11 @@ class acl extends plugin
       $aclList= new divSelectBox("aclList");
       $aclList->SetHeight(150);
 
+      // Create a map of all used sections, this allows us to simply hide the remove button 
+      //  if no acl is configured for the given section 
+      // e.g. ';all;department/country;users/user;
+      $usedList = ";".implode(array_keys($this->aclContents),';').";";
+
       /* Add settings for all categories to the (permanent) list */
       foreach ($this->aclObjects as $section => $dsc){
         $summary= "";
@@ -548,7 +553,7 @@ class acl extends plugin
         if($this->acl_is_readable("")){
           $actions.= image('images/lists/edit.png','cat_edit_'.$section, msgPool::editButton(_("category ACL")));
         }
-        if($this->acl_is_removeable()){
+        if($this->acl_is_removeable() && preg_match("/;".$section."(;|\/)/", $usedList)){
           $actions.= image('images/lists/trash.png','cat_del_'.$section, msgPool::delButton(_("category ACL")));
         }   
 
@@ -1261,7 +1266,7 @@ class acl extends plugin
           "plCategory"    => array("acl" => array("description"  => _("ACL")." & "._("ACL roles"),
                                                           "objectClass"  => array("gosaAcl","gosaRole"))),
           "plProvidedAcls"=> array(
-//            "cn"          => _("Role name"),
+            "gosaAclEntry"          => _("Acl entries")
 //            "description" => _("Role description")
             )
 
@@ -1349,6 +1354,12 @@ class acl extends plugin
     }
   }
 
+  
+  // We are only interessted in our own acls ... 
+  function set_acl_category($category)
+  {
+    plugin::set_acl_category("acl");
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: