From 4ea7e02cd2a1b03466af25f87cf1ff4ff463f386 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 23 Jun 2008 07:00:50 +0000 Subject: [PATCH] Removed duplicated code in get_module_departments. -The resolving of the ACLs was exactly the same. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11402 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_userinfo.inc | 76 ++++------------------------ 1 file changed, 10 insertions(+), 66 deletions(-) diff --git a/gosa-core/include/class_userinfo.inc b/gosa-core/include/class_userinfo.inc index 34634669f..68df16329 100644 --- a/gosa-core/include/class_userinfo.inc +++ b/gosa-core/include/class_userinfo.inc @@ -310,7 +310,6 @@ class userinfo $path= split(',', $dn); $path= array_reverse($path); - /* Walk along the path to evaluate the acl */ $cpath= ""; foreach ($path as $element){ @@ -464,8 +463,6 @@ class userinfo } } - - /* Search for per object ACLs. */ $this->config->get_departments(); @@ -503,73 +500,20 @@ class userinfo /* For all gosaDepartments */ foreach ($this->config->departments as $dn){ - $acl= array("r" => "", "w" => "", "c" => "", "d" => "", "m" => "", "a" => ""); - - /* Build dn array */ - $path= split(',', $dn); - $path= array_reverse($path); - - /* Walk along the path to evaluate the acl */ - $cpath= ""; - foreach ($path as $element){ - - /* Clean potential ACLs for each level */ - $acl= $this->cleanACL($acl); - - if ($cpath == ""){ - $cpath= $element; - } else { - $cpath= $element.','.$cpath; - } - if (isset($this->ACL[$cpath])){ - - /* Inspect this ACL, place the result into ACL */ - foreach ($this->ACL[$cpath] as $subacl){ - - /* Reset? Just clean the ACL and turn over to the next one... */ - if ($subacl['type'] == 'reset'){ - $acl= $this->cleanACL($acl, TRUE); - continue; - } - - if($subacl['type'] == 'role'){ - echo "role skipped"; - continue; - } - - /* Per object ACL? */ - foreach ($objects as $object){ - if (isset($subacl['acl']["$module/$object"])){ - foreach($subacl['acl']["$module/$object"] as $attribute => $dcl){ - $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl']["$module/$object"][$attribute]); - } - } - } - - /* Global ACL? */ - if (isset($subacl['acl']["$module/all"][0])){ - $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl']["$module/all"][0]); - continue; - } - - /* Global ACL? */ - if (isset($subacl['acl']["all"][0])){ - $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl']["all"][0]); - continue; - } - } - } + if(!is_array($module)){ + $module = array($module); } - - /* Add department, if we have (some) permissions for the required module */ - foreach ($acl as $val){ - if ($val != ""){ - $deps[]= $dn; - break; + $acl = ""; + foreach($module as $mod){ + if(preg_match("/\//",$mod)){ + $acl.= $this->get_permissions($dn,$mod,"0"); + }else{ + $acl.= $this->get_category_permissions($dn,$mod); } } + if($acl !== "") $deps[] = $dn; } - + $ACL_CACHE = &session::get('ACL_CACHE'); $ACL_CACHE['MODULE_DEPARTMENTS'][serialize($module)] = $deps; return ($deps); -- 2.30.2