LdapUserBackend: Utilize $virtualTables

This commit is contained in:
Johannes Meyer 2015-11-10 09:56:27 +01:00
parent c416216822
commit 505f5902c7
1 changed files with 18 additions and 23 deletions

View File

@ -208,6 +208,24 @@ class LdapUserBackend extends LdapRepository implements UserBackendInterface, In
return $query; return $query;
} }
/**
* Initialize this repository's virtual tables
*
* @return array
*
* @throws ProgrammingError In case $this->userClass has not been set yet
*/
protected function initializeVirtualTables()
{
if ($this->userClass === null) {
throw new ProgrammingError('It is required to set the object class where to find users first');
}
return array(
'user' => $this->userClass
);
}
/** /**
* Initialize this repository's query columns * Initialize this repository's query columns
* *
@ -317,29 +335,6 @@ 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
*
* This will return $this->userClass in case $table equals "user".
*
* @param string $table The table to validate
* @param RepositoryQuery $query An optional query to pass as context
* (unused by the base implementation)
*
* @return string
*
* @throws ProgrammingError In case the given table does not exist
*/
public function requireTable($table, RepositoryQuery $query = null)
{
$table = parent::requireTable($table, $query);
if ($table === 'user') {
$table = $this->userClass;
}
return $table;
}
/** /**
* 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
* *