Fixed tags in alert list

This commit is contained in:
danielmaya 2018-02-26 13:42:28 +01:00
parent 4b9dd69a0f
commit 25bed4d5c2
2 changed files with 34 additions and 22 deletions

View File

@ -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;
}
}
}

View File

@ -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) {