Code

Updated filter handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 22 Apr 2010 12:20:58 +0000 (12:20 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 22 Apr 2010 12:20:58 +0000 (12:20 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17791 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/generic/references/class_aclResolver.inc

index 1ba56b5b3b14158ba18eb95e05fe532bd7297d01..45b61156033e265ae8f56ed627722c719bfdd5dc 100644 (file)
@@ -8,11 +8,20 @@ class aclResolver
 
     private $renderedList = "";
 
+    // The users 'dn' and 'uid' used to verify the collected acls
+    private $validateDn;
+    private $validateUid;
+
     function __construct($config, $dn, $parent)
     {
         $this->config = &$config;
         $this->dn = $dn;
 
+        // Replace this with a user defined one later.
+        $ui = get_userinfo();
+        $this->validateUid = $ui->uid;
+        $this->validateDn = $ui->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);
@@ -149,11 +158,11 @@ class aclResolver
                     $image = (isset($this->config->idepartments[$dn]))? "images/select_department.png":"images/lists/element.png";
                     $aclType = $this->aclTypes[$acl['type']];
 
-                    // Does the filter match for us
+                    // Does the filter match for current object
                     $filter ="";
                     $match = TRUE;
                     if(!empty($acl['filter'])){
-                        $match = $ldap->object_match_filter($ui->dn,$acl['filter']);
+                        $match = $ldap->object_match_filter($this->dn,$acl['filter']);
                         $filter= $acl['filter'];
                         if(!$match){
                             $filter= "<span>".$filter."</span>";
@@ -164,7 +173,7 @@ class aclResolver
                     if($match){
                         $found = FALSE;
                         foreach($acl['members'] as $mem => $desc){
-                            if($mem == "U:{$ui->dn}"){
+                            if($mem == "U:{$this->validateDn}"){
                                 $found = TRUE;
                                 break;
                             }
@@ -177,7 +186,7 @@ class aclResolver
                                 $ldap->cat($gdn,array('memberUid'));
                                 if($ldap->count()){
                                     $attrs = $ldap->fetch();
-                                    if(isset($attrs['memberUid']) && in_array($ui->uid, $attrs['memberUid'])){
+                                    if(isset($attrs['memberUid']) && in_array($this->validateUid, $attrs['memberUid'])){
                                         $found = TRUE;
                                     }
                                 }