Code

Fixed group base detection.
[gosa.git] / plugins / admin / groups / class_groupGeneric.inc
index b57e4c1d25ec688e4c5692ce57774ba1c8b5737f..a03f6a91ec3a8ac9c53f8ac9b120a2cae6d5d8ec 100644 (file)
@@ -154,7 +154,9 @@ class group extends plugin
         $this->base= dn2base($ui->dn);
       }
     } else {
-      $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
+
+      /* Get object base */
+      $this->base =preg_replace ("/^[^,]+,".normalizePreg(get_groups_ou())."/","",$this->dn);
     }
 
     /* This is always an account */
@@ -205,21 +207,13 @@ class group extends plugin
       $this->reload();
     }
 
-    /* Get bases */
-    $ui = get_userinfo();
-    $check = $ui->get_module_departments("groups");
-    $bases = array();
-    foreach($check as $dn_allowed){
-      $bases[$dn_allowed] = $this->config->idepartments[$dn_allowed];
-    }
-
     /* Base select dialog */
     $once = true;
     foreach($_POST as $name => $value){
       if((preg_match("/^chooseBase/",$name) && $once) && ($this->acl_is_moveable())){
           
         $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$bases);
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
         $this->dialog->setCurrentBase($this->base);
       }
     }
@@ -301,15 +295,7 @@ class group extends plugin
       $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
       $smarty->assign("tree_image", get_template_path('images/tree.png'));
 
-      /* Get bases */
-      $ui = get_userinfo();
-      $check = $ui->get_module_departments("groups");
-      $bases = array();
-      foreach($check as $dn_allowed){
-        $bases[$dn_allowed] = $this->config->idepartments[$dn_allowed];
-      }
-      $smarty->assign("deplist", $bases_user_select);
+      $smarty->assign("deplist", $this->get_allowed_bases("users/user"));
       $smarty->assign("alphabet", generate_alphabet());
       foreach( array("dselect", "regex","SubSearchGroup") as $type){
         $smarty->assign("$type", $gufilter[$type]);
@@ -326,7 +312,7 @@ class group extends plugin
       $this->base= $_POST['base'];
     }
 
-    $smarty->assign("bases", $bases);
+    $smarty->assign("bases", $this->get_allowed_bases());
     $smarty->assign("base_select", $this->base);
 
     if ($this->samba3){
@@ -903,10 +889,11 @@ class group extends plugin
 
           "plProvidedAcls"    => array(
             "cn"                => _("Name"),
+            "base"              => _("Base"),
             "description"       => _("Description"),
 
-            "fonGroup"         => _("Phone pickup group"),
-            "nagiosGroup"      => _("Nagios group"),
+            "fonGroup"          => _("Phone pickup group"),
+            "nagiosGroup"       => _("Nagios group"),
 
             "gidNumber"         => _("GID"),
             "memberUid"         => _("Group member"),