config = &$config; $this->dn = $dn; // Get ACL category for the current object. if(isset($parent->acl_category) && !empty($parent->acl_category)){ $this->acl_category = preg_replace("/\/$/","",$parent->acl_category); } // Build class mapping if(!session::is_set('aclConverter::classMapping')){ $tmp= session::global_get('plist'); $plist= $tmp->info; $map = array(); $map['all']= _("All categories"); foreach($plist as $class => $plInfo){ if(isset($plInfo['plCategory']) && is_array($plInfo['plCategory'])){ foreach($plInfo['plCategory'] as $category => $desc){ if(!is_numeric($category)){ $map[$category] = $desc['description']; } } } } foreach($plist as $class => $plInfo){ if(isset($plInfo['plCategory']) && is_array($plInfo['plCategory'])){ foreach($plInfo['plCategory'] as $category => $desc){ if(!is_numeric($category)){ $map[$category."/".$class] = $map[$category]." - ".$plInfo['plDescription']; }else{ $map[$desc."/".$class] = $map[$desc]." - ".$plInfo['plDescription']; } } } } session::set('aclConverter::classMapping', $map); } $this->classMapping = session::get('aclConverter::classMapping'); // Go through all ACLs and get those matching out DN. $ui = get_userinfo(); foreach($ui->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; } } } } } } // Define ACL type translations $this->aclTypes= array("reset" => _("Reset ACLs"), "one" => _("One level"), "base" => _("Current object"), "sub" => _("Complete subtree"), "psub" => _("Complete subtree (permanent)"), "role" => _("Use ACL defined in role")); } /*! \brief Create a human readable HTML result */ 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"); } $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str .= ""; if($acl['type']!='reset'){ $str.=""; $str .= ""; }else{ $str .= ""; } $str .= ""; } } $str .= "
".$image."".$dn."".$this->aclTypes[$acl['type']]."
"._("Members")."
    "; foreach($acl['members'] as $type => $name){ $str .= "
  • ".$name."
  • "; } $str .= "
"; $str .= "
"._("Acls")."
    "; foreach($acl['acl'] as $type => $acl){ if(isset($this->classMapping[$type])){ $str .= "
  • ".$this->classMapping[$type].": ".$this->aclToString($acl)."
  • "; }else{ $str .= "
  • ".$type.": ".$this->aclToString($acl)."
  • "; } } $str .= "
"; $str .= "

"; return($str); } function aclToString($acls) { $str =""); } } ?>