From: cajus Date: Wed, 26 Jul 2006 13:16:58 +0000 (+0000) Subject: ACL refresh X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=da6de1ed136c1659d451e61cf00b950b7cf2e249;p=gosa.git ACL refresh * Added global catch all acl git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4318 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_acl.inc b/include/class_acl.inc index 8103ba16e..dbb175408 100644 --- a/include/class_acl.inc +++ b/include/class_acl.inc @@ -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']= '* '._("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)); } diff --git a/include/class_pluglist.inc b/include/class_pluglist.inc index 81048f148..c29dfde11 100644 --- a/include/class_pluglist.inc +++ b/include/class_pluglist.inc @@ -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) diff --git a/include/class_tabs.inc b/include/class_tabs.inc index 777c87426..78147cd0f 100644 --- a/include/class_tabs.inc +++ b/include/class_tabs.inc @@ -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() diff --git a/include/class_userinfo.inc b/include/class_userinfo.inc index 737bde73f..20c48209b 100644 --- a/include/class_userinfo.inc +++ b/include/class_userinfo.inc @@ -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']); diff --git a/plugins/admin/users/tabs_user.inc b/plugins/admin/users/tabs_user.inc index c3d726f1e..ce7cf00fb 100644 --- a/plugins/admin/users/tabs_user.inc +++ b/plugins/admin/users/tabs_user.inc @@ -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)