From d9f360016b8ab211fc5dbb0b01abafe5231c94c5 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 26 Jan 2021 09:06:49 +0100 Subject: [PATCH] user_list optimization --- pandora_console/godmode/users/user_list.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 5178cce690..a297811c8d 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -412,17 +412,21 @@ if (!defined('METACONSOLE')) { $table->valign[6] = 'top'; } -$group_um = users_get_groups_UM($config['id_user']); - $info1 = []; $user_is_admin = users_is_admin(); -// Is admin or has group permissions all. -if ($user_is_admin || isset($group_um[0])) { + +if ($user_is_admin) { $info1 = get_users($order); } else { - foreach ($group_um as $group => $value) { - $info1 = array_merge($info1, users_get_users_by_group($group, $value)); + $group_um = users_get_groups_UM($config['id_user']); + // 0 is the group 'all'. + if (isset($group_um[0])) { + $info1 = get_users($order); + } else { + foreach ($group_um as $group => $value) { + $info1 = array_merge($info1, users_get_users_by_group($group, $value)); + } } }