From: hickert Date: Tue, 19 Jan 2010 10:53:34 +0000 (+0000) Subject: Updated baseSelectDialog X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ea7846106496f0a5b69a2b84e321ee95557107c8;p=gosa.git Updated baseSelectDialog -Filter out invalid target bases git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15193 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_baseSelectDialog.inc b/gosa-core/include/class_baseSelectDialog.inc index a4fbf387a..017b7da76 100644 --- a/gosa-core/include/class_baseSelectDialog.inc +++ b/gosa-core/include/class_baseSelectDialog.inc @@ -40,6 +40,7 @@ class baseSelectDialog extends management $this->config = $config; $this->ui = get_userinfo(); $this->allowedBases = $onlyAllowThisBases; + session::set('filterBaseSelect_WhiteList', &$this->allowedBases); # // Build filter # if (session::global_is_set(get_class($this)."_filter")){ @@ -133,5 +134,24 @@ class baseSelectDialog extends management return($action); } } + +class filterBaseSelect extends filterLDAP +{ + static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "") + { + $res= filterLDAP::query($base, $scope, $filter, $attributes, $category, $objectStorage); + return(filterBaseSelect::filterEntries($res)); + } + + static function filterEntries($res) + { + if(!session::is_set('filterBaseSelect_WhiteList')) return $res; + $list = session::get('filterBaseSelect_WhiteList'); + foreach($res as $key => $entry){ + if(!isset($list[$entry['dn']])) unset($res[$key]); + } + return(array_values($res)); + } +} // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>