Code

Updated divlists.
[gosa.git] / plugins / admin / fai / class_divListFai.inc
index 1a735a3a2f8aa1cf46a91276c59e6acc10c9951e..95e193f1dcb5805a76cefcb5ec537f56530e2c43 100644 (file)
@@ -106,6 +106,9 @@ class divListFai extends MultiSelectWindow
     $options= "";
 
     /* Get all departments within this subtree */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
     $base = $this->config->current['BASE'];
     $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
                     array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
@@ -116,6 +119,14 @@ class divListFai 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>";
@@ -125,6 +136,13 @@ class divListFai extends MultiSelectWindow
       }
     }
 
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
     /* Add seperator */
     $add_sep = false;