diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php index a7e10894be..947fe55c92 100644 --- a/pandora_console/include/functions_tags.php +++ b/pandora_console/include/functions_tags.php @@ -1216,13 +1216,23 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags = array(), $c //check user without tags $sql = "SELECT id_usuario FROM tusuario_perfil WHERE id_usuario = '".$config["id_user"]."' AND tags = '' - AND id_perfil IN (SELECT id_perfil FROM tperfil WHERE ".get_acl_column($access)."=1)"; + AND id_perfil IN (SELECT id_perfil FROM tperfil WHERE ".get_acl_column($access)."=1) + AND id_grupo = ".$id_group; $user_has_perm_without_tags = db_get_all_rows_sql ($sql); if ($user_has_perm_without_tags) { return true; } + $tags_str = ''; + if (!empty($tags)) { + foreach ($tags as $tag) { + $tag_id = tags_get_id($tag); + $tags_aux[$tag_id] = $tag_id; + } + $tags_str = implode(',', $tags_aux); + } + $query = sprintf("SELECT tags, id_grupo FROM tusuario_perfil, tperfil WHERE tperfil.id_perfil = tusuario_perfil.id_perfil AND @@ -1250,7 +1260,7 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags = array(), $c $group_ids = implode(',', $childrens_ids); } $sql = "SELECT id_usuario FROM tusuario_perfil - WHERE id_usuario = '".$config["id_user"]."' AND tags = '$tags_user' + WHERE id_usuario = '".$config["id_user"]."' AND tags IN ('$tags_str') AND id_perfil IN (SELECT id_perfil FROM tperfil WHERE ".get_acl_column($access)."=1) AND id_grupo IN ($group_ids)"; $has_perm = db_get_value_sql ($sql);