Code

Updated divlists.
[gosa.git] / plugins / admin / acl / class_divListACL.inc
index 0507b7074d215abdef09a812b7ee7836475753b7..56fe9ae35a6626d23a1953af9f66c9060801248a 100644 (file)
@@ -70,6 +70,9 @@ class divListACL extends MultiSelectWindow
     $Copy_Paste = "";
 
     /* Get all departments within this subtree */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
     $base = $this->config->current['BASE'];
     $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", "acl", $base,
                     array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
@@ -80,6 +83,14 @@ class divListACL extends MultiSelectWindow
     $ids    = $this->config->idepartments;
     foreach($deps as $dep){
       if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+  
         $value = $ids[$dep['dn']];
         if ($this->selectedBase == $dep['dn']){
           $options.= "<option selected='selected' value='".$dep['dn']."'>$value</option>";
@@ -89,6 +100,13 @@ class divListACL extends MultiSelectWindow
       }
     }
 
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
     /* Allow copy & paste for roles */ 
     $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"acl");
     $acl      = $ui->get_permissions($this->selectedBase,"acl/acl");