From 54a74c43d0fd37637303e0007f2aa33f02f643e4 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Tue, 3 Jul 2018 13:11:00 +0200 Subject: [PATCH] Remove the 'All Groups' option in non-administrators users --- pandora_console/godmode/events/event_edit_filter.php | 6 +++--- pandora_console/godmode/reporting/graph_builder.main.php | 4 ++-- .../godmode/reporting/reporting_builder.main.php | 8 ++++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index 1909b2aec9..851e5b5e58 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -224,9 +224,9 @@ $table->data[1][1] = html_print_select_groups( '', false, '', false, false, 'id_grupo', $strict_user); $table->data[2][0] = '' . __('Group').''; -$table->data[2][1] = html_print_select_groups($config["id_user"], $access, - true, 'id_group', $id_group, '', '', -1, true, false, false, '', - false, false, false, false, 'id_grupo', $strict_user); +$display_all_group = (users_is_admin() || users_can_manage_group_all("AR")); +$table->data[2][1] = html_print_select_groups($config['id_user'], "AR", +$display_all_group, 'id_group', $idGroup, '', '', '', true); $types = get_event_types (); // Expand standard array to add not_normal (not exist in the array, used only for searches) diff --git a/pandora_console/godmode/reporting/graph_builder.main.php b/pandora_console/godmode/reporting/graph_builder.main.php index b441aeda14..31b4cb71a9 100644 --- a/pandora_console/godmode/reporting/graph_builder.main.php +++ b/pandora_console/godmode/reporting/graph_builder.main.php @@ -119,9 +119,9 @@ $own_info = get_user_info ($config['id_user']); echo "".__('Group').""; if (check_acl ($config['id_user'], 0, "RW")) - echo html_print_select_groups($config['id_user'], 'RW', true, 'graph_id_group', $id_group, '', '', '', true); + echo html_print_select_groups($config['id_user'], 'RW', $display_all_group, 'graph_id_group', $id_group, '', '', '', true); elseif (check_acl ($config['id_user'], 0, "RM")) - echo html_print_select_groups($config['id_user'], 'RM', true, 'graph_id_group', $id_group, '', '', '', true); + echo html_print_select_groups($config['id_user'], 'RM', $display_all_group, 'graph_id_group', $id_group, '', '', '', true); echo ""; echo ""; echo "".__('Description').""; diff --git a/pandora_console/godmode/reporting/reporting_builder.main.php b/pandora_console/godmode/reporting/reporting_builder.main.php index 05cb417933..191da6dcfa 100755 --- a/pandora_console/godmode/reporting/reporting_builder.main.php +++ b/pandora_console/godmode/reporting/reporting_builder.main.php @@ -67,10 +67,14 @@ $table->data['name'][1] = html_print_input_text('name', $reportName, __('Name'), 80, 100, true, false, true); $table->data['group'][0] = __('Group'); +$display_all_group = (users_is_admin() || users_can_manage_group_all("AR")); +$write_groups = users_get_groups_for_select(false, "AR", $display_all_group, true, false, 'id_grupo'); -$write_groups = users_get_groups_for_select(false, "RW", - true, true, false, 'id_grupo'); + html_print_select_groups($config['id_user'], "AR", + $display_all_group, 'id_group', $idGroup, '', '', '', true); + + // If the report group is not among the RW groups (special permission) we add it if (!isset($write_groups[$idGroupReport]) && $idGroupReport) { $write_groups[$idGroupReport] = groups_get_name($idGroupReport);