index 01315479d61e08eafce76df79a733e5cc2550c18..dae522f0f46ce28e24e30a023c68fe39c10701a3 100644 (file)
}
/* Restrictions? */
}
/* Restrictions? */
- if (isset($attrs['gosaLoginRestrictions'])){
- $this->restrictions= $attrs['gosaLoginRestrictions'];
+ if (isset($attrs['gosaLoginRestriction'])){
+ $this->restrictions= $attrs['gosaLoginRestriction'];
unset($this->restrictions['count']);
}
unset($this->restrictions['count']);
}
function loadACL()
{
$this->ACL= array();
function loadACL()
{
$this->ACL= array();
+ $this->allACLs= array();
$this->groups= array();
$this->result_cache =array();
$this->reset_acl_cache();
$this->groups= array();
$this->result_cache =array();
$this->reset_acl_cache();
foreach($aclc[$dn] as $idx => $type){
$interresting= FALSE;
foreach($aclc[$dn] as $idx => $type){
$interresting= FALSE;
- /* No members? This is good for all users... */
+ /* No members? This ACL rule is deactivated ... */
if (!count($type['members'])){
if (!count($type['members'])){
- $interresting= TRUE;
+ $interresting= FALSE;
} else {
/* Inspect members... */
} else {
/* Inspect members... */
if (preg_replace('/^U:/', '', $grp) == $this->dn){
$interresting= TRUE;
}
if (preg_replace('/^U:/', '', $grp) == $this->dn){
$interresting= TRUE;
}
+
+ /* Wildcard? */
+ if (preg_match('/^G:\*/', $grp)){
+ $interresting= TRUE;
+ }
+ $this->allACLs[$dn][$idx]= $type;
}
}
}
}
/* Remove all acl entries which are especially for the current user (self acl)
*/
/* 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]);
+ }
+ }
}
}
}
}
}
}
}
}
+ /* Returns an array containing all target objects we've permssions on.
+ */
+ function get_acl_target_objects()
+ {
+ return(array_keys($this->ACLperPath));
+ }
+
+
function get_category_permissions($dn, $category, $any_acl = FALSE)
{
function get_category_permissions($dn, $category, $any_acl = FALSE)
{
- return(@$this->get_permissions($dn,$category.'/0',""));
+ return($this->get_permissions($dn,$category.'/0',""));
}
}
return($ret);
}
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->get_cfg_value("displayErrors") == "true"){
+ 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;
/* Detect the set of ACLs we have to check for this object
*/
$adn = $dn;
$acl= array("r" => "", "w" => "", "c" => "", "d" => "", "m" => "", "a" => "");
/* Build dn array */
$acl= array("r" => "", "w" => "", "c" => "", "d" => "", "m" => "", "a" => "");
/* Build dn array */
- $path= split(',', $dn);
+ $path= explode(',', $dn);
$path= array_reverse($path);
/* Walk along the path to evaluate the acl */
$path= array_reverse($path);
/* Walk along the path to evaluate the acl */
/* Inspect this ACL, place the result into ACL */
foreach ($ACL[$cpath] as $subacl){
/* 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;
if($subacl['type'] == "role") {
echo "role skipped";
continue;
}
}
}
}
+ /* 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)){
/* Self ACLs?
*/
if($dn != $this->dn && isset($subacl['acl'][$object][0]) && (strpos($subacl['acl'][$object][0],"s") !== FALSE)){
}
/* Global ACL? */
}
/* 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;
if (isset($subacl['acl']['all'][0])){
$acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl']['all'][0]);
continue;
foreach($this->ocMapping[$ocs] as $oc){
if (isset($subacl['acl'][$ocs.'/'.$oc])){
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]);
foreach($subacl['acl'][$ocs.'/'.$oc] as $attr => $dummy){
$acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$ocs.'/'.$oc][$attr]);
foreach($this->ACL as $dn => $infos){
foreach($infos as $info){
$found = FALSE;
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, ",")){
if($found && !isset($this->config->idepartments[$dn])){
while(!isset($this->config->idepartments[$dn]) && strpos($dn, ",")){
}
}
}else{
}
}
}else{
- trigger_error("Invalid type of category ".$category);
+ if($this->config->get_cfg_value("displayErrors") == "true"){
+ trigger_error("Invalid type of category ".$category);
+ }
$acl = "";
}
$this->result_cache['has_complete_category_acls'][$dn][$category] = $acl;
$acl = "";
}
$this->result_cache['has_complete_category_acls'][$dn][$category] = $acl;