diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 7ac3f55261..2457932339 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -545,6 +545,13 @@ if ($search) { } } +foreach ($info1 as $user_id => $user_info) { + // If user is not admin then don't display admin users. + if ($user_is_admin === false && (bool) $user_info['is_admin'] === true) { + unset($info1[$user_id]); + } +} + $info = $info1; // Prepare pagination. @@ -557,11 +564,6 @@ $rowPair = true; $iterator = 0; $cont = 0; foreach ($info as $user_id => $user_info) { - if (!$user_is_admin && $user_info['is_admin']) { - // If user is not admin then don't display admin users. - continue; - } - // User profiles. if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) { $user_profiles = db_get_all_rows_field_filter( diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 9ccd8e1ff0..7c40b92653 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -11053,11 +11053,29 @@ function reporting_get_stats_users($data) $tdata = []; $tdata[0] = html_print_image('images/user.png', true, ['title' => __('Defined users'), 'class' => 'invert_filter']); - $user_groups = users_get_strict_mode_groups($config['id_user'], false); - if (array_key_exists(0, $user_groups)) { - $users = users_get_user_users($config['id_user'], 'AR', true); + $user_is_admin = users_is_admin(); + + $users = []; + + if ($user_is_admin) { + $users = get_users('', ['disabled' => 0], ['id_user', 'is_admin']); } else { - $users = users_get_user_users($config['id_user'], 'AR', false); + $group_um = users_get_groups_UM($config['id_user']); + // 0 is the group 'all'. + if (isset($group_um[0])) { + $users = get_users('', ['disabled' => 0], ['id_user', 'is_admin']); + } else { + foreach ($group_um as $group => $value) { + $users = array_merge($users, users_get_users_by_group($group, $value)); + } + } + } + + foreach ($users as $user_id => $user_info) { + // If user is not admin then don't display admin users. + if ($user_is_admin === false && (bool) $user_info['is_admin'] === true) { + unset($users[$user_id]); + } } $tdata[1] = count($users);