LdapUserGroupBackend: Properly handle multi-valued names

This commit is contained in:
Johannes Meyer 2020-11-16 16:14:47 +01:00
parent 4d4f5b3a69
commit 6a5e12af04
1 changed files with 4 additions and 2 deletions

View File

@ -654,6 +654,7 @@ class LdapUserGroupBackend extends LdapRepository implements Inspectable, UserGr
return $this->ds return $this->ds
->select() ->select()
->from('*', array($this->userNameAttribute)) ->from('*', array($this->userNameAttribute))
->setUnfoldAttribute($this->userNameAttribute)
->setBase($dn) ->setBase($dn)
->fetchOne(); ->fetchOne();
} }
@ -694,8 +695,8 @@ class LdapUserGroupBackend extends LdapRepository implements Inspectable, UserGr
public function requireQueryColumn($table, $name, RepositoryQuery $query = null) public function requireQueryColumn($table, $name, RepositoryQuery $query = null)
{ {
$column = parent::requireQueryColumn($table, $name, $query); $column = parent::requireQueryColumn($table, $name, $query);
if ($name === 'user_name' && $query !== null) { if (($name === 'user_name' || $name === 'group_name') && $query !== null) {
$query->getQuery()->setUnfoldAttribute('user_name'); $query->getQuery()->setUnfoldAttribute($name);
} }
return $column; return $column;
@ -749,6 +750,7 @@ class LdapUserGroupBackend extends LdapRepository implements Inspectable, UserGr
$groupQuery = $this->ds $groupQuery = $this->ds
->select() ->select()
->from($this->groupClass, array($this->groupNameAttribute)) ->from($this->groupClass, array($this->groupNameAttribute))
->setUnfoldAttribute($this->groupNameAttribute)
->where($groupMemberAttribute, $queryValue) ->where($groupMemberAttribute, $queryValue)
->setBase($this->groupBaseDn); ->setBase($this->groupBaseDn);
if ($this->groupFilter) { if ($this->groupFilter) {