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 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 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 * @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; global $config;
//users_is_strict_acl //users_is_strict_acl
@ -1036,7 +1037,11 @@ function tags_get_user_tags($id_user = false, $access = 'AR') {
return array(); return array();
} }
else { 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) $id_group = (int) get_parameter ("ag_group", 0); //0 is the All group (selects all groups)
$free_search = get_parameter("free_search", ''); $free_search = get_parameter("free_search", '');
$user_tag_array = array_values(array_keys(tags_get_user_tags($config['id_user']))); $user_tag_array = tags_get_user_tags($config['id_user'],'AR', true);
$user_tag = '';
foreach ($user_tag_array as $key => $value) { if ($user_tag_array) {
if ($value === end($user_tag_array)) { $user_tag_array = array_values(array_keys($user_tag_array));
$user_tag .= $value;
}
else{
$user_tag .= $value.',';
}
}
$tag_filter = get_parameter("tag_filter", $user_tag); $user_tag = '';
$tag_param_validate = explode(',',$tag_filter); foreach ($user_tag_array as $key => $value) {
if ($value === end($user_tag_array)) {
foreach ($tag_param_validate as $key => $value) { $user_tag .= $value;
if (!in_array($value,$user_tag_array)) { }
db_pandora_audit("ACL Violation", else{
"Trying to access Alert view"); $user_tag .= $value.',';
require ("general/noaccess.php"); }
exit;
} }
$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) { if ($tag_filter) {