Merge branch 'ent-6405-Borrado-conf-md5-data_in-borrar-agente' into 'develop'

Adding delete_agent control for meta

Closes pandora_enterprise#6405

See merge request artica/pandorafms!3583
This commit is contained in:
Daniel Rodriguez 2021-01-14 14:45:10 +01:00
commit 24b71e477b
1 changed files with 12 additions and 12 deletions

View File

@ -1888,24 +1888,19 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
}
} else {
// Delete only if the centralised mode is disabled.
if (is_central_policies_on_node()) {
$headers = getallheaders();
if (isset($headers['idk']) === false || is_management_allowed($headers['idk']) === false) {
returnError('centralized');
exit;
}
// Support for Pandora Enterprise.
if (license_free() === false) {
define('PANDORA_ENTERPRISE', true);
}
if ($agent_by_alias) {
$idsAgents = agents_get_agent_id_by_alias(io_safe_input($id));
} else {
$idAgent = agents_get_agent_id($id, true);
}
if (!$agent_by_alias) {
if (!util_api_check_agent_and_print_error($idAgent, 'string', 'AD')) {
return;
}
}
if ($agent_by_alias) {
foreach ($idsAgents as $id) {
if (!util_api_check_agent_and_print_error($id['id_agente'], 'string', 'AD')) {
continue;
@ -1918,6 +1913,11 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
}
}
} else {
$idAgent = agents_get_agent_id($id, true);
if (!util_api_check_agent_and_print_error($idAgent, 'string', 'AD')) {
return;
}
$result = agents_delete_agent($idAgent, true);
}
}