LdapUserBackend: 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:
parent
8bf4e8d217
commit
d2cc854a61
|
@ -190,24 +190,6 @@ class LdapUserBackend extends LdapRepository implements UserBackendInterface, In
|
||||||
->setFilter($config->filter);
|
->setFilter($config->filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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->baseDn);
|
|
||||||
if ($this->filter) {
|
|
||||||
$query->getQuery()->setNativeFilter($this->filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize this repository's virtual tables
|
* Initialize this repository's virtual tables
|
||||||
*
|
*
|
||||||
|
@ -335,6 +317,28 @@ class LdapUserBackend extends LdapRepository implements UserBackendInterface, In
|
||||||
return ((int) $value) >= $bigBang->diff($now)->days;
|
return ((int) $value) >= $bigBang->diff($now)->days;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate that the requested table exists
|
||||||
|
*
|
||||||
|
* @param string $table The table to validate
|
||||||
|
* @param RepositoryQuery $query An optional query to pass as context
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @throws ProgrammingError In case the given table does not exist
|
||||||
|
*/
|
||||||
|
public function requireTable($table, RepositoryQuery $query = null)
|
||||||
|
{
|
||||||
|
if ($query !== null) {
|
||||||
|
$query->getQuery()->setBase($this->baseDn);
|
||||||
|
if ($this->filter) {
|
||||||
|
$query->getQuery()->setNativeFilter($this->filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::requireTable($table, $query);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate that the given column is a valid query target and return it or the actual name if it's an alias
|
* Validate that the given column is a valid query target and return it or the actual name if it's an alias
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue