* Admin/ActiveDirectory: filtering user-list by groups was not implemented

This commit is contained in:
Ralf Becker 2015-04-02 08:51:36 +00:00
parent a14c880102
commit 21a48297bb

View File

@ -860,7 +860,7 @@ class accounts_ads
$query = ldap::quote(strtolower($param['query'])); $query = ldap::quote(strtolower($param['query']));
$accounts = array(); $accounts = array();
if($param['type'] != 'groups') if($param['type'] !== 'groups')
{ {
if (!empty($query) && $query != '*') if (!empty($query) && $query != '*')
{ {
@ -890,6 +890,11 @@ class accounts_ads
break; 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) foreach($this->filter($filter, 'u', self::$user_attributes) as $account_id => $data)
{ {
$account = $this->_ldap2user($data); $account = $this->_ldap2user($data);
@ -901,7 +906,7 @@ class accounts_ads
$accounts[$account_id] = $account; $accounts[$account_id] = $account;
} }
} }
if ($param['type'] == 'groups' || $param['type'] == 'both') if ($param['type'] === 'groups' || $param['type'] === 'both')
{ {
$query = ldap::quote(strtolower($param['query'])); $query = ldap::quote(strtolower($param['query']));