LdapUserGroupBackend: Automatically unfold the user_name attribute

refs #9772
This commit is contained in:
Johannes Meyer 2015-09-29 09:48:22 +02:00
parent 33c6f2e06b
commit ef1a81897b
1 changed files with 21 additions and 1 deletions

View File

@ -401,7 +401,6 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
$lastModifiedAttribute = 'modifyTimestamp';
}
// TODO(jom): Fetching memberships does not work currently, we'll need some aggregate functionality!
$columns = array(
'group' => $this->groupNameAttribute,
'group_name' => $this->groupNameAttribute,
@ -472,6 +471,27 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
return $table;
}
/**
* Validate that the given column is a valid query target and return it or the actual name if it's an alias
*
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param RepositoryQuery $query An optional query to pass as context
*
* @return string The given column's name
*
* @throws QueryException In case the given column is not a valid query column
*/
public function requireQueryColumn($table, $name, RepositoryQuery $query = null)
{
$column = parent::requireQueryColumn($table, $name, $query);
if ($name === 'user_name' && $query !== null) {
$query->getQuery()->setUnfoldAttribute('user_name');
}
return $column;
}
/**
* Return the groups the given user is a member of
*