Code

Added check to base selection, to check if selected base is available for this user
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Feb 2006 08:26:27 +0000 (08:26 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Feb 2006 08:26:27 +0000 (08:26 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2745 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_baseSelectDialog.inc
plugins/personal/generic/class_user.inc

index d91da77aa904a8846eec68756233bb2698bacba8..9db43a10292897c6d30b79ad993bf54e48949493 100644 (file)
@@ -7,13 +7,18 @@ class baseSelectDialog extends MultiSelectWindow
 //  var $Doesnothing          = ""; // Checkbox which does nothing 
 
   var $selectedBase         = false;  // used to specify the selected base, 
-                                      // false if none is selected 
-  function baseSelectDialog ($config)
+                                      // false if none is selected
+
+  var $allowedBases         = array();
+  function baseSelectDialog ($config,$onlyAllowThisBases = array())
   {
     MultiSelectWindow::MultiSelectWindow($config);
     
     $this->selected_base = $config->current['BASE'];
   
+    $this->allowedBases  = $onlyAllowThisBases;
+
     $this->SetTitle("Base");
     $this->SetSummary(_("Choose a base"));
     $this->SetListHeader("<div style='background:#F0F0F9;padding:5px;'>".
@@ -67,9 +72,16 @@ class baseSelectDialog extends MultiSelectWindow
     /* Add departments, to be able to switch into them
      */
     while($attrs = $ldap->fetch()){
-  
       $key = $attrs['dn']  ;
       $val = $attrs['ou'][0];
+    
+      if(count($this->allowedBases) != 0){
+        if(!isset($this->allowedBases[$key])){
+          continue;
+          break;
+        }
+      }
  
       /* Append description */ 
       if(isset($attrs['description'][0])){
index 7e3d3f45c8d0f05f711246cd27130282fe1cf772..7d6c7c51ec59a5b0c7a9750801a7d058f025108d 100644 (file)
@@ -273,7 +273,7 @@ class user extends plugin
 
     /* Base select dialog */
     if(isset($_POST['chooseBase'])){
-      $this->dialog = new baseSelectDialog($this->config);
+      $this->dialog = new baseSelectDialog($this->config,$this->allowedBasesToMoveTo());
       $this->dialog->setCurrentBase($this->base);
     }
 
@@ -1188,13 +1188,17 @@ class user extends plugin
       $ldap->search("(&(objectClass=posixGroup)(memberUid=".$_SESSION['ui']->username."))",array("gosaSubtreeACL"));
        
       while($attrs = $ldap->fetch()){
-        foreach($attrs['gosaSubtreeACL'] as $attr){
-          if((preg_match("/:user#/",$attr))||(preg_match("/:all/",$attr))){
-            $s =  preg_replace("/^.*ou=groups,/","",$attrs['dn']);
-
-            foreach($this->config->idepartments as $key => $dep) {
-              if(preg_match("/".$s."/i",$key)){
-                $allowed[$key] = $dep;
+    
+        if(isset($attrs['gosaSubtreeACL'])){
+        
+          foreach($attrs['gosaSubtreeACL'] as $attr){
+            if((preg_match("/:user#/",$attr))||(preg_match("/:all/",$attr))){
+              $s =  preg_replace("/^.*ou=groups,/","",$attrs['dn']);
+
+              foreach($this->config->idepartments as $key => $dep) {
+                if(preg_match("/".$s."/i",$key)){
+                  $allowed[$key] = $dep;
+                }
               }
             }
           }