Code

Updated listing class
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 19 May 2011 12:04:06 +0000 (12:04 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 19 May 2011 12:04:06 +0000 (12:04 +0000)
-Check entry permissions in management listings

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20884 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_acl.inc
gosa-core/include/class_listing.inc
gosa-core/include/class_remoteObject.inc

index 6f0af83fb77c5a936b372bc5e982f371db208120..e2bab7dda699f0838989867ef1ff68c80e502d77 100644 (file)
@@ -250,7 +250,7 @@ class acl extends plugin
     $this->sectionList->setDeleteable(false);
     $this->sectionList->setEditable(false);
     $this->sectionList->setWidth("100%");
-    $this->sectionList->setHeight("120px");
+    $this->sectionList->setHeight("220px");
     $this->sectionList->setColspecs(array('200px','*'));
     $this->sectionList->setHeader(array(_("Section"),_("Description")));
     $this->sectionList->setDefaultSortColumn(0);
index 456b3cb8d087bffbe022c7cdf10c81c74de4d57d..5d8e6069c5f1785b79d642c69a463d3a329f4cbb 100644 (file)
@@ -55,7 +55,7 @@ class listing {
     var $height= 0;
     var $scrollPosition= 0;
     var $baseSelector;
-
+    var $aclToObjectClass = array();
 
     function listing($source, $isString = FALSE)
     {
@@ -194,6 +194,10 @@ class listing {
                 $this->objectTypes[$tmp['objectClass']]= $tmp;
                 if (isset($this->xmlData['definition']['objectType'][$index]['category'])){
                     $this->categories[]= $otype['category'];
+
+                    if(isset($otype['category']) && isset($otype['class'])){
+                        $this->aclToObjectClass[$otype['category']."/".$otype['class']][] = $otype['objectClass'];
+                    }
                 }
             }
         }
@@ -385,6 +389,7 @@ class listing {
         }
 
         // Fill with contents, sort as configured
+        $ui = get_userinfo();
         foreach ($this->entries as $row => $entry) {
             $trow= "";
 
@@ -647,6 +652,22 @@ class listing {
         $this->filter->setBase($this->base);
         $this->entries= $this->filter->query();
 
+        // Check entry acls
+        foreach($this->entries as $row => $entry){
+            $acl = "";
+            $found = false;
+            foreach($this->aclToObjectClass as $category => $ocs){
+                if(count(array_intersect($ocs, $entry['objectClass']))){
+                    $acl .= $ui->get_permissions($entry['dn'],$category, 0);
+                    $found = true;
+                }
+            }
+            if(!preg_match("/r/", $acl) && $found){
+                unset($this->entries[$row]);
+                continue;
+            }
+        }
+
         // Fix filter if querie returns NULL
         if ($this->entries == null) {
             $this->entries= array();
index c3e241f08c667abda62c36a74827d28834b714d5..7e21a248d1ae259267543cfa89d370d45968b5c0 100644 (file)
@@ -145,6 +145,11 @@ class remoteObject
         return($this->success);
     }
 
+    function getError()
+    {
+        return($this->lastError);
+    }
+
 
     /*!\brief   A catch all method for setter calls. 
      *