Merge branch '711-Agent-name-en-lugar-de-alias-en-visor-de-actividad-dev' into 'develop'

Changed name by alias when deleting agent

See merge request !380
This commit is contained in:
vgilc 2017-05-17 17:12:46 +02:00
commit 5e442bcb0b
2 changed files with 10 additions and 6 deletions

View File

@ -99,6 +99,7 @@ if ($agent_to_delete) {
if ($enable_agent) {
$result = db_process_sql_update('tagente', array('disabled' => 0), array('id_agente' => $enable_agent));
$alias = agents_get_alias($enable_agent);
if ($result) {
// Update the agent from the metaconsole cache
@ -106,10 +107,10 @@ if ($enable_agent) {
$values = array('disabled' => 0);
enterprise_hook ('agent_update_from_cache', array($enable_agent, $values));
db_pandora_audit("Agent management", 'Enable ' . $enable_agent);
db_pandora_audit("Agent management", 'Enable ' . $alias);
}
else {
db_pandora_audit("Agent management", 'Fail to enable ' . $enable_agent);
db_pandora_audit("Agent management", 'Fail to enable ' . $alias);
}
ui_print_result_message ($result,
@ -118,6 +119,7 @@ if ($enable_agent) {
if ($disable_agent) {
$result = db_process_sql_update('tagente', array('disabled' => 1), array('id_agente' => $disable_agent));
$alias = agents_get_alias($disable_agent);
if ($result) {
// Update the agent from the metaconsole cache
@ -125,10 +127,10 @@ if ($disable_agent) {
$values = array('disabled' => 1);
enterprise_hook ('agent_update_from_cache', array($disable_agent, $values));
db_pandora_audit("Agent management", 'Disable ' . $disable_agent);
db_pandora_audit("Agent management", 'Disable ' . $alias);
}
else {
db_pandora_audit("Agent management", 'Fail to disable ' . $disable_agent);
db_pandora_audit("Agent management", 'Fail to disable ' . $alias);
}
ui_print_result_message ($result,

View File

@ -1836,6 +1836,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
continue;
$agent_name = agents_get_name($id_agent, "");
$agent_alias = io_safe_output(agents_get_alias($id_agent));
/* Check for deletion permissions */
$id_group = agents_get_agent_group ($id_agent);
@ -1943,6 +1944,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
if (enterprise_hook('config_agents_has_remote_configuration', array($id_agent))) {
$agent_name = agents_get_name($id_agent);
$agent_name = io_safe_output($agent_name);
$agent_alias = io_safe_output(agents_get_alias($id_agent));
$agent_md5 = md5 ($agent_name, false);
// Agent remote configuration editor
@ -1957,7 +1959,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
if ($error) {
db_pandora_audit( "Agent management",
"Error: Deleted agent '$agent_name', the error is in the delete conf or md5.");
"Error: Deleted agent '$agent_alias', the error is in the delete conf or md5.");
}
}
}
@ -1969,7 +1971,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
db_process_sql ("delete from ttag_module where id_agente_modulo in (select id_agente_modulo from tagente_modulo where id_agente = ".$id_agent.")");
db_pandora_audit( "Agent management",
"Deleted agent '$agent_name'");
"Deleted agent '$agent_alias'");
// Delete the agent from the metaconsole cache
enterprise_include_once('include/functions_agents.php');