diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php index 08cfecf26e..b754e90f56 100644 --- a/pandora_console/include/functions_tags.php +++ b/pandora_console/include/functions_tags.php @@ -975,10 +975,11 @@ function tags_has_user_acl_tags($id_user = false) { * * @param string ID of the user (with false the user will be taked from config) * @param string Access flag where check what tags have the user + * @param bool returns 0 if the user has all the tags * * @return string SQL condition for tagente_module */ -function tags_get_user_tags($id_user = false, $access = 'AR') { +function tags_get_user_tags($id_user = false, $access = 'AR', $return_tag_any = false) { global $config; //users_is_strict_acl @@ -1036,7 +1037,11 @@ function tags_get_user_tags($id_user = false, $access = 'AR') { return array(); } else { - return $all_tags; + if($return_tag_any) { + return 0; + } else { + return $all_tags; + } } } diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index 848d5e04f7..6667a73291 100755 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -46,30 +46,37 @@ $offset_simple = (int) get_parameter_get ("offset_simple", 0); $id_group = (int) get_parameter ("ag_group", 0); //0 is the All group (selects all groups) $free_search = get_parameter("free_search", ''); -$user_tag_array = array_values(array_keys(tags_get_user_tags($config['id_user']))); -$user_tag = ''; +$user_tag_array = tags_get_user_tags($config['id_user'],'AR', true); -foreach ($user_tag_array as $key => $value) { - if ($value === end($user_tag_array)) { - $user_tag .= $value; - } - else{ - $user_tag .= $value.','; - } -} +if ($user_tag_array) { + $user_tag_array = array_values(array_keys($user_tag_array)); + + $user_tag = ''; -$tag_filter = get_parameter("tag_filter", $user_tag); - -$tag_param_validate = explode(',',$tag_filter); - -foreach ($tag_param_validate as $key => $value) { - if (!in_array($value,$user_tag_array)) { - db_pandora_audit("ACL Violation", - "Trying to access Alert view"); - require ("general/noaccess.php"); - exit; + foreach ($user_tag_array as $key => $value) { + if ($value === end($user_tag_array)) { + $user_tag .= $value; + } + else{ + $user_tag .= $value.','; + } } + $tag_filter = get_parameter("tag_filter", $user_tag); + + $tag_param_validate = explode(',',$tag_filter); + + foreach ($tag_param_validate as $key => $value) { + if (!in_array($value,$user_tag_array)) { + db_pandora_audit("ACL Violation", + "Trying to access Alert view"); + require ("general/noaccess.php"); + exit; + } + } + +} else { + $tag_filter = get_parameter("tag_filter", 0); } if ($tag_filter) {