diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-11-17 16:30:50 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2015-01-28 14:12:12 +0100 |
commit | 323af55b500dcd0cd1e1ce61408a6a416075ef07 (patch) | |
tree | 34452db4ccfc5ee84859b72b8f08fe579a295218 /apps/user_ldap/lib | |
parent | 55142186deb9e163ce3519453ebfe93f6a446666 (diff) | |
download | nextcloud-server-323af55b500dcd0cd1e1ce61408a6a416075ef07.tar.gz nextcloud-server-323af55b500dcd0cd1e1ce61408a6a416075ef07.zip |
inlcude AD primary group in user filter, if a group is selected. fixes #12190
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/wizard.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php index 2e4507a2585..68dff228294 100644 --- a/apps/user_ldap/lib/wizard.php +++ b/apps/user_ldap/lib/wizard.php @@ -850,13 +850,23 @@ class Wizard extends LDAPUtility { } $base = $this->configuration->ldapBase[0]; foreach($cns as $cn) { - $rr = $this->ldap->search($cr, $base, 'cn=' . $cn, array('dn')); + $rr = $this->ldap->search($cr, $base, 'cn=' . $cn, array('dn', 'primaryGroupToken')); if(!$this->ldap->isResource($rr)) { continue; } $er = $this->ldap->firstEntry($cr, $rr); + $attrs = $this->ldap->getAttributes($cr, $er); $dn = $this->ldap->getDN($cr, $er); - $filter .= '(memberof=' . $dn . ')'; + if(empty($dn)) { + continue; + } + $filterPart = '(memberof=' . $dn . ')'; + if(isset($attrs['primaryGroupToken'])) { + $pgt = $attrs['primaryGroupToken'][0]; + $primaryFilterPart = '(primaryGroupID=' . $pgt .')'; + $filterPart = '(|' . $filterPart . $primaryFilterPart . ')'; + } + $filter .= $filterPart; } $filter .= ')'; } |