Code

ACL refresh
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 26 Jul 2006 13:16:58 +0000 (13:16 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 26 Jul 2006 13:16:58 +0000 (13:16 +0000)
* Added global catch all acl

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4318 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_acl.inc
include/class_pluglist.inc
include/class_tabs.inc
include/class_userinfo.inc
plugins/admin/users/tabs_user.inc

index 8103ba16e8e4a756dfbf215a447f9113d656eeef..dbb17540841721f9fc73cdbc88b7a52f4879aab2 100644 (file)
@@ -27,7 +27,6 @@ class acl extends plugin
   var $currentIndex= 0;
   var $wasNewEntry= FALSE;
   var $ocMapping= array();
-  var $multiClass= array();
   var $savedAclContents= array();
 
 
@@ -107,11 +106,6 @@ class acl extends plugin
       /* Only feed categories */
       if (isset($acls['plCategory'])){
 
-        /* Find multi homed classes */
-        if (count($acls['plCategory']) > 1){
-          $this->multiClass[$class]= $class;
-        }
-
         /* Walk through supplied list and feed only translated categories */
         foreach($acls['plCategory'] as $idx => $data){
 
@@ -134,21 +128,13 @@ class acl extends plugin
             if (is_array($data['objectClass'])){
               foreach($data['objectClass'] as $objectClass){
                 if (in_array_ics($objectClass, $oc)){
-                  if (isset($this->multiClass[$class])){
-                    $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
-                  } else {
-                    $this->myAclObjects[$class]= $acls['plDescription'];
-                  }
+                  $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
                   break;
                 }
               }
             } else {
               if (in_array_ics($data['objectClass'], $oc)){
-                if (isset($this->multiClass[$class])){
-                  $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
-                } else {
-                  $this->myAclObjects[$class]= $acls['plDescription'];
-                }
+                $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
               }
             }
           }
@@ -156,6 +142,8 @@ class acl extends plugin
         }
       }
     }
+    $this->aclObjects['all']= '*&nbsp;'._("All categories");
+    $this->ocMapping['all']= array('0' => '0');
 
     /* Sort categories */
     asort($this->aclObjects);
@@ -461,16 +449,14 @@ class acl extends plugin
       $smarty->assign('headline', sprintf(_("Edit ACL for '%s', scope is '%s'"), $this->aclObjects[$this->aclObject], $this->aclTypes[$this->aclType]));
 
       /* Collect objects for selected category */
-      $aclObjects= array();
       foreach ($this->ocMapping[$this->aclObject] as $idx => $class){
         if ($idx == 0){
           continue;
         }
-        if (isset($this->multiClass[$class])){
-          $aclObjects[$this->aclObject.'/'.$class]= $plist[$class]['plDescription'];
-        } else {
-          $aclObjects[$class]= $plist[$class]['plDescription'];
-        }
+        $aclObjects[$this->aclObject.'/'.$class]= $plist[$class]['plDescription'];
+      }
+      if ($this->aclObject == 'all'){
+        $aclObjects['all']= _("All objects in current subtree");
       }
       $smarty->assign('aclSelector', $this->buildAclSelector($aclObjects));
     }
index 81048f1489f1ebbab93de532877844fa1e989752..c29dfde116dffe04c1fbd6f56ce917609ff0a3ea 100644 (file)
@@ -46,6 +46,12 @@ class pluglist {
                                 $this->info[$cname]= @call_user_func(array($cname, 'plInfo'));
                         }
                 }
+
+               /* Provide field for 'all' */
+               $this->info['all']= array();
+               $this->info['all']['plProvidedAcls']= array();
+               $this->info['all']['plDescription']= _("All objects in this category");
+               $this->info['all']['plSelfModify']= FALSE;
        }
 
        function get_plugins($list, $config)
index 777c87426e2bc6cb27017eb2f84182c2cc00daed..78147cd0fa6332c23b400a2319e017b6d90e3f28 100644 (file)
@@ -33,7 +33,7 @@ class tabs
   var $by_object= array();
   var $SubDialog = false;
 
-  function tabs($config, $data, $dn)
+  function tabs($config, $data, $dn, $acl_category= "")
   {
        /* Save dn */
        $this->dn= $dn;
@@ -43,13 +43,13 @@ class tabs
                $this->by_name[$tab['CLASS']]= $tab['NAME'];
                $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn);
                $this->by_object[$tab['CLASS']]->parent= &$this;
+               $this->by_object[$tab['CLASS']]->set_acl_category($acl_category);
 
                /* Initialize current */
                if ($this->current == ""){
                        $this->current= $tab['CLASS'];
                }
        }
-
   }
 
   function execute()
index 737bde73f22221a1750de0b1f5180b2571a73e13..20c48209b71ac4c6758286d5017793afa2891d45 100644 (file)
@@ -160,7 +160,7 @@ class userinfo
 
   function get_permissions($dn, $object, $attribute, $skip_write= FALSE)
   {
-    $acl= array("r" => "", "w" => "", "c" => "", "d" => "", "m" => "");
+    $acl= array("r" => "", "w" => "", "c" => "", "d" => "", "m" => "", "a" => "");
 
     /* Build dn array */
     $path= split(',', $dn);
@@ -202,8 +202,8 @@ class userinfo
           }
 
           /* Global ACL? */
-          if (isset($subacl['acl'][0])){
-            $acl= $this->mergeACL($acl, $subacl['type'], preg_replace('/[cdm]/', '', $subacl['acl'][0]));
+          if (isset($subacl['acl']['all'])){
+            $acl= $this->mergeACL($acl, $subacl['type'], preg_replace('/[cdm]/', '', $subacl['acl']['all'][0]));
             continue;
           }
 
@@ -256,7 +256,7 @@ class userinfo
     $ldap->cd($this->config->current['BASE']);
     $ldap->search('objectClass=gosaDepartment', array('dn'));
     while ($attrs= $ldap->fetch()){
-      $acl= array("r" => "", "w" => "", "c" => "", "d" => "", "m" => "");
+      $acl= array("r" => "", "w" => "", "c" => "", "d" => "", "m" => "", "a" => "");
 
       /* Build dn array */
       $path= split(',', $attrs['dn']);
index c3d726f1e9a92dd596ec1488fa549c2d83b5fdcc..ce7cf00fbc4b33c54b84e9b1cd67895fa7cec1cb 100644 (file)
@@ -6,17 +6,12 @@ class usertabs extends tabs
 
   function usertabs($config, $data, $dn)
   {
-    tabs::tabs($config, $data, $dn);
+    tabs::tabs($config, $data, $dn, 'users');
     $this->base= $this->by_object['user']->base;
 
     /* Add references/acls/snapshots */
     $this->addSpecialTabs();
     $this->set_acl_base();
-
-    /* Set category for environment tab */
-    if (isset($this->by_object['environment'])){
-      $this->by_object['environment']->set_acl_category('users');
-    }
   }
 
   function save_object($save_current= FALSE)