X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_userinfo.inc;h=c69ef528ea0a9a759db25124bbff2f7feba9d6e5;hb=a1042e3e00ba59c4bf021996296bed796f1a815c;hp=1b5fac84eb57e51b426f94f8f004acc4d57790e1;hpb=969ab73c733a8eed9122fbb5b14a52857eec992a;p=gosa.git diff --git a/gosa-core/include/class_userinfo.inc b/gosa-core/include/class_userinfo.inc index 1b5fac84e..c69ef528e 100644 --- a/gosa-core/include/class_userinfo.inc +++ b/gosa-core/include/class_userinfo.inc @@ -77,7 +77,7 @@ class userinfo $this->uid= $attrs['uid'][0]; $this->ip= $_SERVER['REMOTE_ADDR']; - $this->ignoreACL = ($this->config->get_cfg_value("ignoreAcl") == $this->dn); + $this->ignoreACL = ($this->config->get_cfg_value("core","ignoreAcl") == $this->dn); /* Initialize ACL_CACHE */ $this->reset_acl_cache(); @@ -93,6 +93,7 @@ class userinfo function loadACL() { $this->ACL= array(); + $this->allACLs= array(); $this->groups= array(); $this->result_cache =array(); $this->reset_acl_cache(); @@ -180,6 +181,7 @@ class userinfo if (preg_match('/^G:\*/', $grp)){ $interresting= TRUE; } + $this->allACLs[$dn][$idx]= $type; } } @@ -225,10 +227,12 @@ class userinfo /* Remove all acl entries which are especially for the current user (self acl) */ - foreach($acl_set['acl'] as $object => $object_acls){ - if(isset($object_acls[0]) && strpos($object_acls[0],"s")){ - unset($without_self_acl[$sdn][$dn][$acl_id]['acl'][$object]); - } + if(isset($acl_set['acl'])){ + foreach($acl_set['acl'] as $object => $object_acls){ + if(isset($object_acls[0]) && strpos($object_acls[0],"s")){ + unset($without_self_acl[$sdn][$dn][$acl_id]['acl'][$object]); + } + } } } } @@ -258,7 +262,7 @@ class userinfo function get_category_permissions($dn, $category, $any_acl = FALSE) { - return(@$this->get_permissions($dn,$category.'/0',"")); + return($this->get_permissions($dn,$category.'/0',"")); } @@ -359,6 +363,31 @@ class userinfo return($ret); } + /* Check for correct category and class values... */ + if(strpos($object,'/') !== FALSE){ + list($aclCategory, $aclClass) = preg_split("!/!", $object); + }else{ + $aclCategory = $object; + } + + if($this->config->boolValueIsTrue("core","developmentMode")){ + + if(!isset($this->ocMapping[$aclCategory])){ + trigger_error("Invalid ACL category '".$aclCategory."'! ({$object})"); + return(""); + }elseif(isset($aclClass) && !in_array($aclClass, $this->ocMapping[$aclCategory])){ + trigger_error("Invalid ACL class '".$aclClass."'! ({$object})"); + return(""); + } + if(isset($aclClass) &&class_available($aclClass)){ + $plInfo = call_user_func(array($aclClass, 'plInfo')); + if(!empty($attribute) && !isset($plInfo['plProvidedAcls'][$attribute])){ + trigger_error("Invalid ACL attribute '".$attribute."'! ({$object})"); + return(""); + } + } + } + /* Detect the set of ACLs we have to check for this object */ $adn = $dn; @@ -420,12 +449,6 @@ class userinfo /* Inspect this ACL, place the result into ACL */ foreach ($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; @@ -442,6 +465,12 @@ class userinfo } } + /* Reset? Just clean the ACL and turn over to the next one... */ + if ($subacl['type'] == 'reset'){ + $acl= $this->cleanACL($acl, TRUE); + continue; + } + /* Self ACLs? */ if($dn != $this->dn && isset($subacl['acl'][$object][0]) && (strpos($subacl['acl'][$object][0],"s") !== FALSE)){ @@ -471,6 +500,12 @@ class userinfo } /* Global ACL? */ + if (isset($subacl['acl']['all/all'][0])){ + $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl']['all/all'][0]); + continue; + } + + /* Global ACL? - Old style global ACL - Was removed since class_core.inc was created */ if (isset($subacl['acl']['all'][0])){ $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl']['all'][0]); continue; @@ -489,7 +524,10 @@ class userinfo foreach($this->ocMapping[$ocs] as $oc){ if (isset($subacl['acl'][$ocs.'/'.$oc])){ - if($dn != $this->dn && strpos($subacl['acl'][$ocs.'/'.$oc][0],"s") !== FALSE) continue; + // Skip ACLs wich are defined for ourselfs only - if not checking against ($ui->dn) + if(isset($subacl['acl'][$ocs.'/'.$oc][0]) && + $dn != $this->dn && + strpos($subacl['acl'][$ocs.'/'.$oc][0],"s") !== FALSE) continue; foreach($subacl['acl'][$ocs.'/'.$oc] as $attr => $dummy){ $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$ocs.'/'.$oc][$attr]); @@ -568,15 +606,17 @@ class userinfo foreach($this->ACL as $dn => $infos){ foreach($infos as $info){ $found = FALSE; - foreach($info['acl'] as $cat => $data){ - - /* Skip self acls? */ - if($skip_self_acls && isset($data['0']) && (strpos($data['0'], "s") !== FALSE)) continue; - if(preg_match("/^".preg_quote($mod, '/')."/",$cat)){ - $found =TRUE; - break; - } - } + if(isset($info['acl'])){ + foreach($info['acl'] as $cat => $data){ + + /* Skip self acls? */ + if($skip_self_acls && isset($data['0']) && (strpos($data['0'], "s") !== FALSE)) continue; + if(preg_match("/^".preg_quote($mod, '/')."/",$cat)){ + $found =TRUE; + break; + } + } + } if($found && !isset($this->config->idepartments[$dn])){ while(!isset($this->config->idepartments[$dn]) && strpos($dn, ",")){ @@ -705,7 +745,9 @@ class userinfo } } }else{ - trigger_error("Invalid type of category ".$category); + if($this->config->boolValueIsTrue("core","developmentMode")){ + trigger_error("Invalid type of category ".$category); + } $acl = ""; } $this->result_cache['has_complete_category_acls'][$dn][$category] = $acl;