From 7e67360fdad88fb82d7837ec62f8a7f844ac750a Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Wed, 16 Feb 2011 18:39:28 +0000 Subject: [PATCH] 2011-02-16 Juan Manuel Ramon * include/functions_alerts.php: New function get_alert_actions_filter. * operation/agentes/estado_agente.php: If user is not admin or doesn't have 'PM' privileges then don't display alerts of others groups. * godmode/alerts/configure_alert_template.php: If user is not admin or doesn't have 'PM' privileges then don't display templates of others groups. * godmode/alerts/configure_alert_action.php: Don't show "create command" option in this view if current user is not administrator or or doesn't have 'PM' privileges. * godmode/alerts/alert_list.builder.php: If user is not admin or doesn't have 'PM' privileges then don't display alerts of others groups. Fixes: #3182557, 3182566 * include/functions_visual_map.php: Added a parameter in function get_user_layouts for return All group or not. * godmode/reporting/visual_console_builder.data.php: In map creation only display "All" group if user has 'PM' privileges or is administrator. * godmode/reporting/map_builder.php: If user is not admin or doesn't have 'PM' privileges then don't display maps of others groups. * operation/visual_console/index.php: If user is not admin or doesn't have 'PM' privileges then don't display maps of others groups. Fixes: #3175721, 3175730 * godmode/users/configure_user.php: Only are shown "pandora management" and "database management" profiles if current user is not administrator or or doesn't have 'PM' privileges. * godmode/alerts/alert_list.list.php: Fixed query for alert search. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3887 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 31 ++++++++++++++++++ .../godmode/alerts/alert_list.builder.php | 10 +++++- .../godmode/alerts/alert_list.list.php | 8 +++-- .../godmode/alerts/configure_alert_action.php | 18 ++++++++--- .../alerts/configure_alert_template.php | 8 ++++- .../godmode/reporting/map_builder.php | 10 +++++- .../reporting/visual_console_builder.data.php | 10 +++++- .../godmode/users/configure_user.php | 8 +++-- pandora_console/include/functions_alerts.php | 32 +++++++++++++++++++ .../include/functions_visual_map.php | 8 +++-- .../operation/agentes/estado_agente.php | 22 ++++++++----- .../operation/visual_console/index.php | 8 ++++- 12 files changed, 149 insertions(+), 24 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 0ab6d6947d..219c35f3f1 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,34 @@ +2011-02-16 Juan Manuel Ramon + + * include/functions_alerts.php: New function get_alert_actions_filter. + * operation/agentes/estado_agente.php: If user is not admin or doesn't have + 'PM' privileges then don't display alerts of others groups. + * godmode/alerts/configure_alert_template.php: If user is not admin or doesn't have + 'PM' privileges then don't display templates of others groups. + * godmode/alerts/configure_alert_action.php: Don't show "create command" option + in this view if current user is not administrator or or doesn't have + 'PM' privileges. + * godmode/alerts/alert_list.builder.php: If user is not admin or doesn't have + 'PM' privileges then don't display alerts of others groups. + + Fixes: #3182557, 3182566 + + * include/functions_visual_map.php: Added a parameter in function get_user_layouts for + return All group or not. + * godmode/reporting/visual_console_builder.data.php: In map creation only display "All" + group if user has 'PM' privileges or is administrator. + * godmode/reporting/map_builder.php: If user is not admin or doesn't have + 'PM' privileges then don't display maps of others groups. + * operation/visual_console/index.php: If user is not admin or doesn't have + 'PM' privileges then don't display maps of others groups. + + Fixes: #3175721, 3175730 + + * godmode/users/configure_user.php: Only are shown "pandora management" and + "database management" profiles if current user is not administrator or or doesn't have + 'PM' privileges. + * godmode/alerts/alert_list.list.php: Fixed query for alert search. + 2011-02-16 Ramon Novoa * include/functions_menu.php: Fixed a typo. diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index baed8c1954..818732ffb0 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -64,7 +64,15 @@ $table->data[0][1] .= print_image('images/spinner.png', true) . ''; $table->data[1][0] = __('Template'); $table->data[1][0] = __('Template'); -$templates = get_alert_templates (false, array ('id', 'name')); +$own_info = get_user_info ($config['id_user']); +if ($own_info['is_admin']) + $templates = get_alert_templates (false, array ('id', 'name')); +else{ + $usr_groups = get_user_groups($config['id_user'], 'LW', false); + $filter_groups = ''; + $filter_groups = implode(',', array_keys($usr_groups)); + $templates = get_alert_templates (array ('id_group IN (' . $filter_groups . ')'), array ('id', 'name')); +} $table->data[1][1] = print_select (index_array ($templates, 'id', 'name'), 'template', '', '', __('Select'), 0, true); diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 23a5ae4d21..b6d5b05b39 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -131,7 +131,7 @@ if ($searchFlag) { FROM tagente AS t1 INNER JOIN tagente_modulo AS t2 ON t1.id_agente = t2.id_agente WHERE t1.nombre LIKE '" . trim($agentName) . "')"; if ($actionID != -1) - $where .= " AND id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = " . $actionID . ")"; + $where .= " AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = " . $actionID . ")"; if ($enabledisable != -1) $where .= " AND talert_template_modules.disabled =" . $enabledisable; if ($standby != -1) @@ -479,7 +479,11 @@ foreach ($simple_alerts as $alert) { $data[6] .= '