From 13a0a4239ec38fd208c924cac1d0fb3847bb04ad Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 27 Feb 2006 08:26:27 +0000 Subject: [PATCH] Added check to base selection, to check if selected base is available for this user git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2745 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_baseSelectDialog.inc | 18 ++++++++++++++--- plugins/personal/generic/class_user.inc | 20 +++++++++++-------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/plugins/admin/systems/class_baseSelectDialog.inc b/plugins/admin/systems/class_baseSelectDialog.inc index d91da77aa..9db43a102 100644 --- a/plugins/admin/systems/class_baseSelectDialog.inc +++ b/plugins/admin/systems/class_baseSelectDialog.inc @@ -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("
". @@ -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])){ diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 7e3d3f45c..7d6c7c51e 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -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; + } } } } -- 2.30.2