Fix for support issue 9950, do lookups properly on posixGroup group classes

This commit is contained in:
Jo Rhett 2015-09-18 13:37:04 -07:00
parent dd0e924e8d
commit f3df1f228d
1 changed files with 10 additions and 3 deletions

View File

@ -543,15 +543,22 @@ class LdapUserGroupBackend /*extends LdapRepository*/ implements UserGroupBacken
$userQuery->where(new Expression($this->userFilter)); $userQuery->where(new Expression($this->userFilter));
} }
if (($userDn = $userQuery->fetchDn()) === null) { # Posix group only uses simple user name
if ($this->groupClass == 'posixGroup') {
$queryUsername = $user->getUsername();
}
# LDAP groups use the complete DN
else {
if (($queryUsername = $userQuery->fetchDn()) === null) {
return array(); return array();
} }
} }
}
$groupQuery = $this->ds $groupQuery = $this->ds
->select() ->select()
->from($this->groupClass, array($this->groupNameAttribute)) ->from($this->groupClass, array($this->groupNameAttribute))
->where($this->groupMemberAttribute, $userDn) ->where($this->groupMemberAttribute, $queryUsername)
->setBase($this->groupBaseDn); ->setBase($this->groupBaseDn);
if ($this->groupFilter) { if ($this->groupFilter) {
$groupQuery->where(new Expression($this->groupFilter)); $groupQuery->where(new Expression($this->groupFilter));