diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4482e55b9c..d477ae0e7f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2011-02-18 Miguel de Dios + + * include/functions_db.php, operation/search_modules.php, + operation/search_agents.php: fixed SQL querys, this querys in previous + version haven't lines SQL code for to search into subgroups. + 2011-02-18 Javier Lanz * operation/servers/view_server.php: Fixed ACL permissions diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index cc877d67ae..82715ccdb9 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -714,12 +714,39 @@ function get_agent_modules ($id_agent = null, $details = false, $filter = false, SELECT id_agente FROM tagente WHERE id_grupo IN ( - SELECT id_grupo - FROM tusuario_perfil - WHERE id_usuario = '" . $config['id_user'] . "' - AND id_perfil IN ( - SELECT id_perfil - FROM tperfil WHERE agent_view = 1 + SELECT id_grupo + FROM tgrupo + WHERE id_grupo IN ( + SELECT id_grupo + FROM tusuario_perfil + WHERE id_usuario = '" . $config['id_user'] . "' + AND id_perfil IN ( + SELECT id_perfil + FROM tperfil WHERE agent_view = 1 + ) + ) + OR ( + parent IN ( + SELECT id_grupo + FROM tusuario_perfil + WHERE id_usuario = '" . $config['id_user'] . "' + AND id_perfil IN ( + SELECT id_perfil + FROM tperfil WHERE agent_view = 1 + ) + ) AND 1 = ( + SELECT propagate + FROM tgrupo + WHERE id_grupo IN ( + SELECT id_grupo + FROM tusuario_perfil + WHERE id_usuario = '" . $config['id_user'] . "' + AND id_perfil IN ( + SELECT id_perfil + FROM tperfil WHERE agent_view = 1 + ) + ) + ) ) ) ) diff --git a/pandora_console/operation/search_agents.php b/pandora_console/operation/search_agents.php index 3ab5733e60..acd387aa19 100755 --- a/pandora_console/operation/search_agents.php +++ b/pandora_console/operation/search_agents.php @@ -116,13 +116,40 @@ if ($searchAgents) { WHERE id_user = '" . $config['id_user'] . "' ) OR t1.id_grupo IN ( - SELECT id_grupo - FROM tusuario_perfil - WHERE id_usuario = '" . $config['id_user'] . "' - AND id_perfil IN ( - SELECT id_perfil - FROM tperfil WHERE agent_view = 1 - ) + SELECT id_grupo + FROM tagente + WHERE id_grupo IN ( + SELECT id_grupo + FROM tusuario_perfil + WHERE id_usuario = '" . $config['id_user'] . "' + AND id_perfil IN ( + SELECT id_perfil + FROM tperfil WHERE agent_view = 1 + ) + ) + OR ( + parent IN ( + SELECT id_grupo + FROM tusuario_perfil + WHERE id_usuario = '" . $config['id_user'] . "' + AND id_perfil IN ( + SELECT id_perfil + FROM tperfil WHERE agent_view = 1 + ) + ) AND 1 = ( + SELECT propagate + FROM tgrupo + WHERE id_grupo IN ( + SELECT id_grupo + FROM tusuario_perfil + WHERE id_usuario = '" . $config['id_user'] . "' + AND id_perfil IN ( + SELECT id_perfil + FROM tperfil WHERE agent_view = 1 + ) + ) + ) + ) ) OR 0 IN ( SELECT id_grupo diff --git a/pandora_console/operation/search_modules.php b/pandora_console/operation/search_modules.php index 7373996798..3ea10a3e81 100644 --- a/pandora_console/operation/search_modules.php +++ b/pandora_console/operation/search_modules.php @@ -64,12 +64,39 @@ if ($searchModules) { INNER JOIN tagente_estado AS t4 ON t4.id_agente_modulo = t1.id_agente_modulo WHERE (t2.id_grupo IN ( - SELECT id_grupo - FROM tusuario_perfil - WHERE id_usuario = "' . $config['id_user'] . '" - AND id_perfil IN ( - SELECT id_perfil - FROM tperfil WHERE agent_view = 1 + SELECT id_grupo + FROM tgrupo + WHERE id_grupo IN ( + SELECT id_grupo + FROM tusuario_perfil + WHERE id_usuario = "' . $config['id_user'] . '" + AND id_perfil IN ( + SELECT id_perfil + FROM tperfil WHERE agent_view = 1 + ) + ) + OR ( + parent IN ( + SELECT id_grupo + FROM tusuario_perfil + WHERE id_usuario = "' . $config['id_user'] . '" + AND id_perfil IN ( + SELECT id_perfil + FROM tperfil WHERE agent_view = 1 + ) + ) AND 1 = ( + SELECT propagate + FROM tgrupo + WHERE id_grupo IN ( + SELECT id_grupo + FROM tusuario_perfil + WHERE id_usuario = "' . $config['id_user'] . '" + AND id_perfil IN ( + SELECT id_perfil + FROM tperfil WHERE agent_view = 1 + ) + ) + ) ) ) OR 0 IN (