Code

Only display allowed bases
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 24 Oct 2006 06:53:41 +0000 (06:53 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 24 Oct 2006 06:53:41 +0000 (06:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4921 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_divListFai.inc

index 9dea993f8e0a207b37a2d8bd35c7b0a19c383ec7..7707658b3dd53e4295310951b155e5977ab084ef 100644 (file)
@@ -95,20 +95,35 @@ class divListFai extends MultiSelectWindow
 
   function GenHeader()
   {
-    $ui = get_userinfo();
     /* Prepare departments,
        which are shown in the listbox on top of the listbox
      */
     $options= "";
-    foreach ($this->config->idepartments as $key => $value){
-      if ($this->selectedBase == $key){
-        $options.= "<option selected='selected' value='$key'>$value</option>";
-      } else {
-        $options.= "<option value='$key'>$value</option>";
+
+    /* 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);
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("fai");
+
+    $ids = $this->config->idepartments;
+
+    foreach($deps as $dep){
+      if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
+
+        $value = $ids[$dep['dn']];
+        if ($this->selectedBase == $dep['dn']){
+          $options.= "<option selected='selected' value='".$dep['dn']."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep['dn']."'>$value</option>";
+        }
       }
     }
 
-        /* Create listhead, it will be shown on top of the divlist.
+     /* Create listhead, it will be shown on top of the divlist.
      * It provides general navigation and object creation
      */
     $listhead =