From 21a48297bb20843bbad8b1d972c422ed39ca0770 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 2 Apr 2015 08:51:36 +0000 Subject: [PATCH] * Admin/ActiveDirectory: filtering user-list by groups was not implemented --- phpgwapi/inc/class.accounts_ads.inc.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/phpgwapi/inc/class.accounts_ads.inc.php b/phpgwapi/inc/class.accounts_ads.inc.php index d789cda319..211bc27897 100644 --- a/phpgwapi/inc/class.accounts_ads.inc.php +++ b/phpgwapi/inc/class.accounts_ads.inc.php @@ -860,7 +860,7 @@ class accounts_ads $query = ldap::quote(strtolower($param['query'])); $accounts = array(); - if($param['type'] != 'groups') + if($param['type'] !== 'groups') { if (!empty($query) && $query != '*') { @@ -890,6 +890,11 @@ class accounts_ads break; } } + if (is_numeric($param['type'])) + { + $membership_filter = '(memberOf='.$this->id2name((int)$param['type'], 'account_dn').')'; + $filter = $filter ? "(&$membership_filter$filter)" : $membership_filter; + } foreach($this->filter($filter, 'u', self::$user_attributes) as $account_id => $data) { $account = $this->_ldap2user($data); @@ -901,7 +906,7 @@ class accounts_ads $accounts[$account_id] = $account; } } - if ($param['type'] == 'groups' || $param['type'] == 'both') + if ($param['type'] === 'groups' || $param['type'] === 'both') { $query = ldap::quote(strtolower($param['query']));