LdapUserGroupBackend: Set a query's base DN when a table gets required

This ensures that the query receives the correct base DN even if the table
gets adjusted by calling from() subsequently.

refs #10567
This commit is contained in:
Johannes Meyer 2015-11-11 12:54:49 +01:00
parent cf193f2c1b
commit 8bf4e8d217
1 changed files with 5 additions and 16 deletions

View File

@ -397,20 +397,6 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
return $this->ambiguousMemberAttribute; return $this->ambiguousMemberAttribute;
} }
/**
* Return a new query for the given columns
*
* @param array $columns The desired columns, if null all columns will be queried
*
* @return RepositoryQuery
*/
public function select(array $columns = null)
{
$query = parent::select($columns);
$query->getQuery()->setBase($this->groupBaseDn);
return $query;
}
/** /**
* Initialize this repository's virtual tables * Initialize this repository's virtual tables
* *
@ -575,8 +561,11 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
*/ */
public function requireTable($table, RepositoryQuery $query = null) public function requireTable($table, RepositoryQuery $query = null)
{ {
if ($query !== null && $table === 'group' && $this->groupFilter) { if ($query !== null) {
$query->getQuery()->setNativeFilter($this->groupFilter); $query->getQuery()->setBase($this->groupBaseDn);
if ($table === 'group' && $this->groupFilter) {
$query->getQuery()->setNativeFilter($this->groupFilter);
}
} }
return parent::requireTable($table, $query); return parent::requireTable($table, $query);