config = &$config; $this->dn = $dn; $this->parent = &$parent; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); $ldap->cat($dn); $this->attrs = $ldap->fetch(); if(isset($this->parent->acl_category) && !empty($this->parent->acl_category)){ $this->acl_category = preg_replace("/\/$/","",$this->parent->acl_category); } if(isset($attrs['uid'][0])){ $this->uid = $attrs['uid'][0]; } $this->ignoreACL = ($this->config->get_cfg_value("ignoreAcl") == $this->dn); $this->reset_acl_cache(); $this->loadACL(); foreach($this->allACLs as $dn => $acls){ if(preg_match("/".preg_quote($dn,'/')."$/i", $this->dn)){ foreach($acls as $prio => $acl){ if($acl['type'] == "reset"){ $this->affectingACLs[$dn][$prio] = $acl; break; }else{ foreach($acl['acl'] as $category => $attributes){ if(preg_match("/^all($|\/)/", $category) || preg_match("/^".$this->acl_category."($|\/)/", $category)){ $this->affectingACLs[$dn][$prio] = $acl; break; } } } } } } } function getReadableACL() { $str = ""; foreach($this->affectingACLs as $dn => $acls){ foreach($acls as $acl){ $str.=""; if(isset($this->config->idepartments[$dn])){ $image= image("images/select_department.png"); }else{ $image= image("images/lists/element.png"); } $aclTypes= array("reset" => _("Reset ACLs"), "one" => _("One level"), "base" => _("Current object"), "sub" => _("Complete subtree"), "psub" => _("Complete subtree (permanent)"), "role" => _("Use ACL defined in role")); $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; if($acl['type']!='reset'){ $str.=""; $str .= ""; } $str .= ""; } } $str .= "
".$image."".$dn."".$aclTypes[$acl['type']]."
"._("Members")."
    "; foreach($acl['members'] as $type => $name){ $str .= "
  • ".$name."
  • "; } $str .= "
"; $str .= "
"._("Acls")."
    "; foreach($acl['acl'] as $type => $name){ $str .= "
  • ".$type.": ".$this->aclToString(implode(array_unique($name)))."
  • "; } $str .= "
"; $str .= "

"; return($str); } function aclToString($acl) { $str =""; if(preg_match("/r/", $acl)) $str.= _("read").', '; if(preg_match("/w/", $acl)) $str.= _("write").', '; if(preg_match("/c/", $acl)) $str.= _("Create").', '; if(preg_match("/d/", $acl)) $str.= _("Remove").', '; if(preg_match("/m/", $acl)) $str.= _("Move").', '; if(preg_match("/s/", $acl)) $str.= _("Owner").', '; return(trim($str,', ')); } } ?>