From b0d09d29e3f3e0054ac5c3cd1ee41d3df24dec1d Mon Sep 17 00:00:00 2001 From: Alex ORLUC <alex.orluc@maarch.org> Date: Wed, 29 Aug 2018 15:13:52 +0200 Subject: [PATCH] FIX #7822 keep other role available if user is in difflist --- modules/entities/manage_listinstance.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/modules/entities/manage_listinstance.php b/modules/entities/manage_listinstance.php index 60bea512510..b2e25e60a82 100755 --- a/modules/entities/manage_listinstance.php +++ b/modules/entities/manage_listinstance.php @@ -1001,8 +1001,7 @@ $linkwithwhat = //****************************************************************************** // LIST OF AVAILABLE USERS //****************************************************************************** - if (count($users) > 0) { - $usersListDiff = array(); ?> + if (count($users) > 0) { ?> <div align="center"> <h3 class="tit"><?php echo _USERS_LIST; ?></h3> <table cellpadding="0" cellspacing="0" border="0" class="listing spec"> @@ -1014,23 +1013,19 @@ $linkwithwhat = </tr> </thead><?php $color = ' class="col"'; + foreach ($available_roles as $id => $label) { $available_roles_ids[] = $id; } - foreach ($user_roles as $key => $value) { - $usersListDiff[] = $key; - } - for ($j = 0, $m = count($users); - $j < $m; - ++$j - ) { + + for ($j = 0, $m = count($users); $j < $m; ++$j) { $user_id = $users[$j]['ID']; $possible_roles = array(); - if (!in_array($user_id, $usersListDiff)) { - foreach ($roles as $role_id => $role_label) { - if (in_array($role_id, $available_roles_ids) || $usergroups_controler->inGroup($users[$j]['ID'], $role_id)) { + foreach ($roles as $role_id => $role_label) { + if (in_array($role_id, $available_roles_ids) || $usergroups_controler->inGroup($users[$j]['ID'], $role_id)) { + if ($user_roles[$user_id] == null || !in_array($role_id, $user_roles[$user_id])) { $possible_roles[$role_id] = $role_label; } } -- GitLab