From d8d2d23ba118df9bbefdc6f2e091feb3a0b1cfb6 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Fri, 14 May 2010 09:25:39 +0000 Subject: [PATCH] 2010-05-14 Sergio Martin * include/functions_db.php operation/agentes/ver_agente.php godmode/agentes/massive_edit_modules.php: Fixed the ACL check into groups combo for bug 3001500 and All agents display for bug 2999431 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2727 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 ++++++++ .../godmode/agentes/massive_edit_modules.php | 1 - pandora_console/include/functions_db.php | 10 ++++++++-- pandora_console/operation/agentes/ver_agente.php | 15 +++++++++++++-- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index f0d346a07e..b36772b557 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2010-05-14 Sergio Martin + + * include/functions_db.php + operation/agentes/ver_agente.php + godmode/agentes/massive_edit_modules.php: Fixed the + ACL check into groups combo for bug 3001500 and + All agents display for bug 2999431 + 2010-05-14 Miguel de Dios * include/gettext.php: Sorry I forget part of changes in "fixed the bug of diff --git a/pandora_console/godmode/agentes/massive_edit_modules.php b/pandora_console/godmode/agentes/massive_edit_modules.php index 884ce24ff2..5357758f3e 100644 --- a/pandora_console/godmode/agentes/massive_edit_modules.php +++ b/pandora_console/godmode/agentes/massive_edit_modules.php @@ -160,7 +160,6 @@ $names = get_agent_modules (array_keys ($agents), foreach ($names as $name) { $modules[$name['nombre']] = $name['nombre']; } -$agents = null; $table->data[0][2] = __('Module name'); $table->data[0][3] = print_select ($modules, 'module_name', diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 29fcc1fad9..07fcb5d323 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -1334,14 +1334,20 @@ function give_agentmodule_flag ($id_agent_module) { function get_all_groups($groupWithAgents = false) { $sql = 'SELECT id_grupo, nombre FROM tgrupo'; + global $config; + if ($groupWithAgents) $sql .= ' WHERE id_grupo IN (SELECT id_grupo FROM tagente GROUP BY id_grupo)'; + $sql .= ' ORDER BY nombre DESC'; + $rows = get_db_all_rows_sql ($sql); $return = array(); - foreach ($rows as $row) - $return[$row['id_grupo']] = $row['nombre']; + foreach ($rows as $row) { + if (give_acl ($config['id_user'], $row["id_grupo"], "AR")) + $return[$row['id_grupo']] = $row['nombre']; + } return $return; } diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 8f3a6df960..a216aec692 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -36,8 +36,19 @@ if (is_ajax ()) { if ($get_agents_group_json) { $id_group = get_parameter('id_group'); - $agents = get_db_all_rows_sql("SELECT id_agente, nombre FROM tagente WHERE id_grupo = ". $id_group); - + if($id_group > 0) + $filter = " WHERE id_grupo = ". $id_group; + else { + $groups_orig = get_user_groups(); + + $a = 0; + $groups = array_keys($groups_orig); + + $filter = " WHERE id_grupo IN (". implode(',', $groups) .")"; + } + + $agents = get_db_all_rows_sql("SELECT id_agente, nombre FROM tagente". $filter); + echo json_encode($agents); return; }