From e260b6fac13ef6c67358461d3591bd436a9904b4 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 21 Apr 2010 12:31:16 +0000 Subject: [PATCH] test git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17776 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../generic/references/class_aclResolver.inc | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 gosa-core/plugins/generic/references/class_aclResolver.inc diff --git a/gosa-core/plugins/generic/references/class_aclResolver.inc b/gosa-core/plugins/generic/references/class_aclResolver.inc new file mode 100644 index 000000000..d3c16f5f8 --- /dev/null +++ b/gosa-core/plugins/generic/references/class_aclResolver.inc @@ -0,0 +1,120 @@ +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,', ')); + } +} + +?> + -- 2.30.2