remove agents bulk operation pandora_enterprise#12299
This commit is contained in:
parent
071427e60b
commit
7258188491
|
@ -46,6 +46,7 @@ require_once $config['homedir'].'/include/functions_alerts.php';
|
|||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
require_once $config['homedir'].'/include/functions_massive_operations.php';
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
|
||||
|
||||
/**
|
||||
|
@ -71,12 +72,15 @@ function process_manage_delete($id_agents)
|
|||
$array_id = explode('|', $id_agent);
|
||||
try {
|
||||
$node = new Node((int) $array_id[0]);
|
||||
$node->connect();
|
||||
|
||||
$agent = new Agent((int) $array_id[1]);
|
||||
$success = $agent->delete();
|
||||
|
||||
$node->disconnect();
|
||||
$api_call_delete = $node->callApi(
|
||||
'delete_agent',
|
||||
'set',
|
||||
(int) $array_id[1],
|
||||
null,
|
||||
['2'],
|
||||
null,
|
||||
true
|
||||
);
|
||||
|
||||
$success = agent_delete_from_metaconsole(
|
||||
$array_id[1],
|
||||
|
|
|
@ -2266,9 +2266,12 @@ function api_set_delete_agent($id, $thrash1, $other, $returnType)
|
|||
}
|
||||
|
||||
$agent_by_alias = false;
|
||||
$agent_by_id = false;
|
||||
|
||||
if ($other['data'][0] === '1') {
|
||||
$agent_by_alias = true;
|
||||
} else if ($other['data'][0] === '2') {
|
||||
$agent_by_id = true;
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
|
@ -2331,7 +2334,12 @@ function api_set_delete_agent($id, $thrash1, $other, $returnType)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$idAgent = agents_get_agent_id($id, false);
|
||||
if ($agent_by_id === true) {
|
||||
$idAgent = $id;
|
||||
} else {
|
||||
$idAgent = agents_get_agent_id($id, false);
|
||||
}
|
||||
|
||||
if (!util_api_check_agent_and_print_error($idAgent, 'string', 'AD')) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue