diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php index acbc478cb3..c9f04e92fb 100644 --- a/pandora_console/include/functions_tags.php +++ b/pandora_console/include/functions_tags.php @@ -672,10 +672,13 @@ function tags_get_acl_tags($id_user, $id_group, $access = 'AR', $acltags = tags_get_user_module_and_tags($id_user, $access); - // Delete the groups without tag restrictions from the acl tags array if $force_group_and_tag == false // Delete the groups that aren't in the received groups id $acltags_aux = array(); + + if (!empty($groups) && in_array(0, $groups)) { + $acltags_aux[0] = ""; + } foreach ($acltags as $group_id => $tags) { if (!empty($groups) && array_search($group_id, $groups) === false) { unset($acltags[$group_id]); @@ -860,7 +863,7 @@ function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group foreach ($acltags as $group_id => $group_tags) { // Group condition (The module belongs to an agent of the group X) // Juanma (08/05/2014) Fix : Get all groups (children also, Propagate ACL func!) - $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_id_recursive($group_id)))); + $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_id_recursive($group_id, true)))); $_groups_not_in .= implode(',', array_values(groups_get_id_recursive($group_id))) . ','; // Tags condition (The module has at least one of the restricted tags) diff --git a/pandora_console/operation/events/events.build_query.php b/pandora_console/operation/events/events.build_query.php index d66728be3b..8bd79b7b3a 100755 --- a/pandora_console/operation/events/events.build_query.php +++ b/pandora_console/operation/events/events.build_query.php @@ -191,8 +191,8 @@ if (!empty($tag_with)) { $first = true; foreach ($tag_with as $id_tag) { if ($first) $first = false; - else $sql_post .= " OR "; - $sql_post .= "tags = '" . tags_get_name($id_tag) . "'"; + else $sql_post .= " AND "; + $sql_post .= "tags LIKE '%" . tags_get_name($id_tag) . "%'"; } $sql_post .= ' ) '; } @@ -203,7 +203,7 @@ if (!empty($tag_without)) { if ($first) $first = false; else $sql_post .= " AND "; - $sql_post .= "tags <> '" . tags_get_name($id_tag) . "'"; + $sql_post .= "tags NOT LIKE '%" . tags_get_name($id_tag) . "%'"; } $sql_post .= ' ) '; } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index b5fa5b0f7e..2f47bc36e0 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -25,8 +25,6 @@ require_once ($config['homedir'].'/include/functions_ui.php'); check_login (); - - if (! check_acl ($config["id_user"], 0, "ER") && ! check_acl ($config["id_user"], 0, "EW") && ! check_acl ($config["id_user"], 0, "EM")) { db_pandora_audit("ACL Violation", "Trying to access event viewer");