From 119b5318085ea8cef0b8f3f07167ad446220cc4a Mon Sep 17 00:00:00 2001 From: darode Date: Wed, 11 Apr 2012 09:22:22 +0000 Subject: [PATCH] 2012-04-11 Dario Rodriguez * operation/agentes/estado_agente.php: Added columns to edit agent from operaion view. Only for admins git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5937 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++ .../operation/agentes/estado_agente.php | 44 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 08cdd5f685..ae19f42e67 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2012-04-11 Dario Rodriguez + + * operation/agentes/estado_agente.php: Added columns to edit agent + from operaion view. Only for admins + 2012-04-11 Juan Manuel Ramon * godmode/groups/group_list.php diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 193b3b6705..af0affd548 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -109,6 +109,25 @@ if (is_ajax ()) { } ob_end_clean(); +$agent_to_delete = get_parameter("borrar_agente"); +if (!empty($agent_to_delete)) { + $id_agente = $agent_to_delete; + $agent_name = agents_get_name ($id_agente); + $id_grupo = agents_get_agent_group($id_agente); + if (check_acl ($config["id_user"], $id_grupo, "AW")==1) { + $id_agentes[0] = $id_agente; + $result = agents_delete_agent($id_agentes); + db_pandora_audit("Agent management", "Delete Agent " . $agent_name); + } + else { + // NO permissions. + db_pandora_audit("ACL Violation", + "Trying to delete agent \'$agent_name\'"); + require ("general/noaccess.php"); + exit; + } +} + $first = true; while ($row = db_get_all_row_by_steps_sql($first, $result, "SELECT * FROM tgrupo")) { $first = false; @@ -373,6 +392,15 @@ $table->head[8] = __('Last contact'). ' ' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . ''; $table->align = array (); + +//Only for AW flag +if (check_acl ($config["id_user"], $group_id, "AW")) { + $table->head[9] = __('R'); + $table->align[9] = "center"; + $table->head[10] = __('Delete'); + $table->align[10] = "center"; +} + $table->align[2] = "center"; $table->align[3] = "center"; $table->align[4] = "center"; @@ -468,6 +496,22 @@ foreach ($agents as $agent) { // This old code was returning "never" on agents without modules, BAD !! // And does not print outdated agents in red. WRONG !!!! // $data[7] = ui_print_timestamp ($agent_info["last_contact"], true); + + //Only for AW flag + if (check_acl ($config["id_user"], $group_id, "AW")) { + // Has remote configuration ? + $data[9]=""; + $agent_name = db_get_value("nombre", "tagente", "id_agente", $agent["id_agente"]); + $agent_md5 = md5 ($agent_name, false); + if (file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5")) { + $data[9] = "". + html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Edit remote config'))).""; + } + + $data[10] = "'.html_print_image('images/cross.png', true, array("border" => '0')) .""; + } array_push ($table->data, $data); }