From: hickert Date: Mon, 23 Jun 2008 07:00:50 +0000 (+0000) Subject: Removed duplicated code in get_module_departments. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4ea7e02cd2a1b03466af25f87cf1ff4ff463f386;p=gosa.git 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 --- 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);