From fd540f58805383ccb6d848cb7348e60c6ca3374a Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Thu, 10 Oct 2013 16:11:39 +0000 Subject: [PATCH] 2013-10-10 Sergio Martin * include/functions_agents.php include/functions_alerts.php operation/agentes/status_monitor.php operation/agentes/status_events.php mobile/operation/modules.php: Fixed several calls to acl tags with same fixes of Juanma in previous commits git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8887 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 9 +++++++++ pandora_console/include/functions_agents.php | 11 +++++++++-- pandora_console/include/functions_alerts.php | 4 +++- pandora_console/mobile/operation/modules.php | 2 +- pandora_console/operation/agentes/status_events.php | 2 +- pandora_console/operation/agentes/status_monitor.php | 7 +++++-- 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index bc1e91f513..495f4fc5c8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2013-10-10 Sergio Martin + + * include/functions_agents.php + include/functions_alerts.php + operation/agentes/status_monitor.php + operation/agentes/status_events.php + mobile/operation/modules.php: Fixed several calls + to acl tags with same fixes of Juanma in previous commits + 2013-10-10 Sergio Martin * include/functions_agents.php: Change the way of diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 0684a2d345..8f09f13297 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -155,7 +155,9 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f } if (($id_agent !== false) && ($idGroup !== false)) { - $where_tags = tags_get_acl_tags($config['id_user'], $idGroup, 'AR', 'module_condition', 'AND', 'tagente_modulo'); + $groups = users_get_groups($config["id_user"]); + + $where_tags = tags_get_acl_tags($config['id_user'], $groups, 'AR', 'module_condition', 'AND', 'tagente_modulo'); if ($idGroup != 0) { //All group $subQuery = 'SELECT id_agente_modulo FROM tagente_modulo @@ -635,7 +637,12 @@ function agents_get_next_contact($idAgent, $maxModules = false) { $difference = get_system_time () - strtotime ($agent["ultimo_contacto"]); - return round ($difference / ($agent["intervalo"] / 100)); + if ($agent["intervalo"] > 0 && strtotime($agent["ultimo_contacto"]) > 0) { + return round ($difference / ($agent["intervalo"] / 100)); + } + else { + return 0; + } } /** diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 3887ae8537..b8808381d8 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -1572,8 +1572,10 @@ function get_group_alerts($id_group, $filter = '', $options = false, if ($id_group !== false) { + $groups = users_get_groups($config["id_user"]); + $where_tags = tags_get_acl_tags($config['id_user'], - $idGroup, 'AR', 'module_condition', 'AND', 'tagente_modulo'); + array_keys($groups), 'AR', 'module_condition', 'AND', 'tagente_modulo'); if ($id_group != 0) { if (is_array($id_group)) { diff --git a/pandora_console/mobile/operation/modules.php b/pandora_console/mobile/operation/modules.php index 8ae5454484..27e0c40fe8 100644 --- a/pandora_console/mobile/operation/modules.php +++ b/pandora_console/mobile/operation/modules.php @@ -289,7 +289,7 @@ class Modules { // Part SQL for the Tag $sql_conditions_tags = tags_get_acl_tags($user->getIdUser(), - $this->group, $this->acl, 'module_condition', 'AND', 'tagente_modulo'); + $user->getIdGroups($this->acl), $this->acl, 'module_condition', 'AND', 'tagente_modulo'); $sql_conditions = " AND tagente_modulo.disabled = 0 AND tagente.disabled = 0"; diff --git a/pandora_console/operation/agentes/status_events.php b/pandora_console/operation/agentes/status_events.php index 825d0c58c5..7c2f4008f6 100644 --- a/pandora_console/operation/agentes/status_events.php +++ b/pandora_console/operation/agentes/status_events.php @@ -29,7 +29,7 @@ echo "

".__('Latest events for this agent' // Fix: for tag functionality groups have to be all user_groups (propagate ACL funct!) $groups = users_get_groups($config["id_user"]); -$tags_condition = tags_get_acl_tags($config['id_user'], /*$agent['id_grupo']*/ array_keys($groups), 'ER', 'event_condition', 'AND'); +$tags_condition = tags_get_acl_tags($config['id_user'], array_keys($groups), 'ER', 'event_condition', 'AND'); events_print_event_table ("estado <> 1 $tags_condition", 10, '100%', false, $id_agente); diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index fae76fa19f..b8c849dc94 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -175,7 +175,10 @@ if (defined('METACONSOLE') && $ag_group !== 0) { $ag_group = groups_get_id($ag_group); } -$sql_conditions_tags = tags_get_acl_tags($config['id_user'], $ag_group, 'AR', 'module_condition', 'AND', 'tagente_modulo'); +// Fix: for tag functionality groups have to be all user_groups (propagate ACL funct!) +$groups = users_get_groups($config["id_user"]); + +$sql_conditions_tags = tags_get_acl_tags($config['id_user'], array_keys($groups), 'AR', 'module_condition', 'AND', 'tagente_modulo'); if(is_numeric($sql_conditions_tags)) { $sql_conditions_tags = ' AND 1 = 0'; @@ -334,7 +337,7 @@ if (!defined('METACONSOLE')) { ' . __('Group') . ' ' . html_print_select_groups(false, "AR", true, "ag_group", - $ag_group, '', __('All'), '0', true, false, false, 'w130', + $ag_group, '', '', '0', true, false, false, 'w130', false, 'width:150px;') . ' '; }