diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-11-17 18:30:50 +0300 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2015-07-23 15:33:30 +0300 |
commit | 0d5b4b95ef030e3ecc265c1e54673ca9df17dab4 (patch) | |
tree | adb75332c6e8bc1162d91ec8a239f2c87720f943 /apps | |
parent | 7cd4425b71bb67507f15cb76562b6018e831ffc8 (diff) |
inlcude AD primary group in user filter, if a group is selected. fixes #12190
Diffstat (limited to 'apps')
-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 ea1cdbdcc7e..5a504cc1772 100644 --- a/apps/user_ldap/lib/wizard.php +++ b/apps/user_ldap/lib/wizard.php @@ -852,13 +852,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 .= ')'; } |