Code

Set of fixes for users/acl
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 21 Aug 2006 11:52:28 +0000 (11:52 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 21 Aug 2006 11:52:28 +0000 (11:52 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4493 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_MultiSelectWindow.inc
include/class_userinfo.inc
plugins/admin/users/class_divListUsers.inc
plugins/admin/users/class_userManagement.inc

index fd1511f1b1c6da7849bd5b3385d746f2bcda6074..60b11f168fd7b396ff3f2ccabf7bb2a0d3e7ba43 100644 (file)
@@ -574,6 +574,7 @@ class MultiSelectWindow{
 
                /* Add deps to this dialog object list */
                foreach($this->departments as $key=> $val){
+
                        /* Add missing entries ... */
                        if(!isset($this->config->departments[trim($key)])){
                                $this->config->departments[trim($key)]="";
index 29d6dc817e95075ddde54d5ae86b134b148a49c8..6595325b275078cace805735ea1a50662dcbcc36 100644 (file)
@@ -132,18 +132,19 @@ class userinfo
         /* No members? This is good for all users... */
         if (!count($type['members'])){
           $interresting= TRUE;
-        }
+        } else {
 
-        /* Inspect members... */
-        foreach ($type['members'] as $grp => $grpdsc){
-          /* Some group inside the members that is relevant for us? */
-          if (in_array_ics(preg_replace('/^G:/', '', $grp), $this->groups)){
-            $interresting= TRUE;
-          }
+          /* Inspect members... */
+          foreach ($type['members'] as $grp => $grpdsc){
+            /* Some group inside the members that is relevant for us? */
+            if (in_array_ics(preg_replace('/^G:/', '', $grp), $this->groups)){
+              $interresting= TRUE;
+            }
 
-          /* User inside the members? */
-          if (preg_replace('/^U:/', '', $grp) == $this->dn){
-            $interresting= TRUE;
+            /* User inside the members? */
+            if (preg_replace('/^U:/', '', $grp) == $this->dn){
+              $interresting= TRUE;
+            }
           }
         }
 
@@ -166,7 +167,7 @@ class userinfo
     $acl= "";
     if (isset($this->ocMapping[$category])){
       foreach($this->ocMapping[$category] as $oc){
-        $acl.= $this->get_permissions($dn, $category."/".$oc, "");
+        $acl.= $this->get_permissions($dn, $category."/".$oc);
       }
     }
 
@@ -253,6 +254,8 @@ echo "Global $object<br>";
   }
 
 
+  /* Extract all departments that are accessible (direct or 'on the way' to an
+     accessible department) */
   function get_module_departments($module)
   {
     global $plist;
@@ -278,15 +281,12 @@ echo "Global $object<br>";
       }
     }
 
-    /* Get all gosaDepartments */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search('objectClass=gosaDepartment', array('dn'));
-    while ($attrs= $ldap->fetch()){
+    /* For all gosaDepartments */
+    foreach ($this->config->departments as $dn){
       $acl= array("r" => "", "w" => "", "c" => "", "d" => "", "m" => "", "a" => "");
 
       /* Build dn array */
-      $path= split(',', $attrs['dn']);
+      $path= split(',', $dn);
       $path= array_reverse($path);
 
       /* Walk along the path to evaluate the acl */
@@ -314,28 +314,32 @@ echo "Global $object<br>";
 
             /* Per object ACL? */
             foreach ($objects as $object){
-              if (isset($subacl['acl'][$object])){
-                foreach($subacl['acl'][$object] as $attribute => $dcl){
-                  if (isset($subacl['acl'][$object][$attribute])){
-                    $acl= $this->mergeACL($acl, $subacl['type'], preg_replace('/[cdm]/', '', $subacl['acl'][$object][$attribute]));
-                  }
+              if (isset($subacl['acl']["$module/$object"])){
+                foreach($subacl['acl']["$module/$object"] as $attribute => $dcl){
+                  $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl']["$module/$object"][$attribute]);
                 }
               }
             }
 
             /* Global ACL? */
-            if (isset($subacl['acl'][0])){
-              $acl= $this->mergeACL($acl, $subacl['type'], preg_replace('/[cdm]/', '', $subacl['acl'][0]));
+            if (isset($subacl['acl']["$module/all"][0])){
+              $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl']["$module/all"][0]);
+              continue;
+            }
+
+            /* Global ACL? */
+            if (isset($subacl['acl']["all"][0])){
+              $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl']["all"][0]);
               continue;
             }
           }
         }
       }
 
-      /* Add department, if we have (some) permissions for the requred module */
+      /* Add department, if we have (some) permissions for the required module */
       foreach ($acl as $val){
         if ($val != ""){
-          $deps[]= $attrs['dn'];
+          $deps[]= $dn;
           break;
         }
       }
index 94260149dbab6b1bfd5db5305079ff8cfcddf732..30423e60c0714668b27ce15ab31022b21bebe0fa 100644 (file)
@@ -79,27 +79,28 @@ class divListUsers extends MultiSelectWindow
        which are shown in the listbox on top of the listbox
      */
     $options= "";
-#print_a($this->config->idepartments);
-#$ui= get_userinfo();
-#$t= $ui->get_module_departments("users");
-#print_a($t);
 
-    
     /* Get all departments within this subtree */ 
     $base = $this->config->current['BASE'];
     $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
                     array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
 
+$ui= get_userinfo();
+$t= $ui->get_module_departments("users");
+print_a($t);
+
     $ids = $this->config->idepartments;
  
+print_a($ids);
+
     foreach($deps as $dep){
       if(isset($ids[$dep['dn']])){
 
         $value = $ids[$dep['dn']]; 
-        if ($this->selectedBase == $dep){
-          $options.= "<option selected='selected' value='$dep'>$value</option>";
+        if ($this->selectedBase == $dep['dn']){
+          $options.= "<option selected='selected' value='".$dep['dn']."'>$value</option>";
         } else {
-          $options.= "<option value='$dep'>$value</option>";
+          $options.= "<option value='".$dep['dn']."'>$value</option>";
         }
       }
     }
index 45a3c6d3ddf99940eeed8991f451694c589549ce..8b95063a4f4b69a3bae4d826f2cc3995b77cb693 100644 (file)
@@ -138,7 +138,7 @@ class userManagement extends plugin
       $this->usertab->current = $s_tab;
 
       /* Set ACL and move DN to the headline */
-#      $this->usertab->set_acl_base();
+      $this->usertab->set_acl_base();
       $_SESSION['objectinfo']= $this->dn;
     }