UserController: Do not show duplicate memberships when showing a user

refs #8826
This commit is contained in:
Johannes Meyer 2015-05-27 09:03:00 +02:00
parent 170379b743
commit 32c1a844b5
1 changed files with 6 additions and 1 deletions

View File

@ -248,10 +248,15 @@ class UserController extends AuthBackendController
*/
protected function loadMemberships(User $user)
{
$groups = array();
$groups = $alreadySeen = array();
foreach ($this->loadUserGroupBackends() as $backend) {
try {
foreach ($backend->getMemberships($user) as $groupName) {
if (array_key_exists($groupName, $alreadySeen)) {
continue; // Ignore duplicate memberships
}
$alreadySeen[$groupName] = null;
$groups[] = (object) array(
'group_name' => $groupName,
'backend' => $backend