LdapUserGroupBackend: Utilize $virtualTables
This commit is contained in:
parent
505f5902c7
commit
d56056bba7
|
@ -371,6 +371,25 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize this repository's virtual tables
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws ProgrammingError In case $this->groupClass has not been set yet
|
||||||
|
*/
|
||||||
|
protected function initializeVirtualTables()
|
||||||
|
{
|
||||||
|
if ($this->groupClass === null) {
|
||||||
|
throw new ProgrammingError('It is required to set the object class where to find groups first');
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'group' => $this->groupClass,
|
||||||
|
'group_membership' => $this->groupClass
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize this repository's query columns
|
* Initialize this repository's query columns
|
||||||
*
|
*
|
||||||
|
@ -515,11 +534,8 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
|
||||||
/**
|
/**
|
||||||
* Validate that the requested table exists
|
* Validate that the requested table exists
|
||||||
*
|
*
|
||||||
* This will return $this->groupClass in case $table equals "group" or "group_membership".
|
|
||||||
*
|
|
||||||
* @param string $table The table to validate
|
* @param string $table The table to validate
|
||||||
* @param RepositoryQuery $query An optional query to pass as context
|
* @param RepositoryQuery $query An optional query to pass as context
|
||||||
* (unused by the base implementation)
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
|
@ -527,17 +543,11 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
|
||||||
*/
|
*/
|
||||||
public function requireTable($table, RepositoryQuery $query = null)
|
public function requireTable($table, RepositoryQuery $query = null)
|
||||||
{
|
{
|
||||||
$table = parent::requireTable($table, $query);
|
if ($query !== null && $table === 'group' && $this->groupFilter) {
|
||||||
if ($table === 'group') {
|
|
||||||
$table = $this->groupClass;
|
|
||||||
if ($query !== null && $this->groupFilter) {
|
|
||||||
$query->getQuery()->setNativeFilter($this->groupFilter);
|
$query->getQuery()->setNativeFilter($this->groupFilter);
|
||||||
}
|
}
|
||||||
} elseif ($table === 'group_membership') {
|
|
||||||
$table = $this->groupClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $table;
|
return parent::requireTable($table, $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue