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() { $tpl = "\n ". "\n %s". "\n %s". "\n %s". "\n ". "\n ". "\n ". "\n "._("Group members")."". "\n ". "\n ". "\n ". "\n "._("Members")."". "\n ". "\n ". "\n ". "\n "._("Acls")."". "\n ". "\n ". "\n
". "\n "; $str = ""; foreach($this->affectingACLs as $dn => $acls){ foreach($acls as $acl){ $gmem = $umem = $defs = ""; $image = (isset($this->config->idepartments[$dn]))? "images/select_department.png":"images/lists/element.png"; $aclType = $this->aclTypes[$acl['type']]; foreach($acl['members'] as $type => $name){ if(preg_match("/^G/", $type)) $gmem .= "\n
  • ".$name."
  • "; } foreach($acl['members'] as $type => $name){ if(!preg_match("/^G/", $type)) $umem .= "\n
  • ".$name."
  • "; } if($acl['type']!='reset'){ foreach($acl['acl'] as $type => $acl){ if(isset($this->classMapping[$type])){ $defs .= "
  • ".$this->classMapping[$type].": ".$this->aclToString($acl)."
  • "; }else{ $defs .= "
  • ".$type.": ".$this->aclToString($acl)."
  • "; } } } $str.= sprintf($tpl, image($image), $dn, $aclType, $gmem, $umem, $defs); } } $str .= "
    "; return($str); } function aclToString($acls) { $str =""); } } ?>