Skip to content

Commit

Permalink
LdapUserGroupBackend: Automatically unfold the user_name attribute
Browse files Browse the repository at this point in the history
refs #9772
  • Loading branch information
Johannes Meyer committed Sep 29, 2015
1 parent 33c6f2e commit ef1a818
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion library/Icinga/Authentication/UserGroup/LdapUserGroupBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ protected function initializeQueryColumns()
$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,
Expand Down Expand Up @@ -472,6 +471,27 @@ public function requireTable($table, RepositoryQuery $query = null)
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
*
Expand Down

0 comments on commit ef1a818

Please sign in to comment.