mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
id server check in api event creation #4158
This commit is contained in:
parent
3c5a893c71
commit
9e449fe1c3
@ -12284,12 +12284,29 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($other['data'][17]) && is_metaconsole()) {
|
||||||
|
$id_server = db_get_row_filter('tmetaconsole_setup', ['id' => $other['data'][17]]);
|
||||||
|
if ($id_server === false) {
|
||||||
|
returnError('error_create_event', __('Server id does not exist in database.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$values['server_id'] = $other['data'][17];
|
||||||
|
} else {
|
||||||
|
$values['server_id'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$error_msg = '';
|
$error_msg = '';
|
||||||
if ($other['data'][2] != '') {
|
if ($other['data'][2] != '') {
|
||||||
$id_agent = $other['data'][2];
|
$id_agent = $other['data'][2];
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
// On metaconsole, connect with the node to check the permissions
|
// On metaconsole, connect with the node to check the permissions
|
||||||
|
if (empty($values['server_id'])) {
|
||||||
$agent_cache = db_get_row('tmetaconsole_agent', 'id_tagente', $id_agent);
|
$agent_cache = db_get_row('tmetaconsole_agent', 'id_tagente', $id_agent);
|
||||||
|
} else {
|
||||||
|
$agent_cache = db_get_row_filter('tmetaconsole_agent', ['id_tagente' => $id_agent, 'id_tmetaconsole_setup' => $values['server_id']]);
|
||||||
|
}
|
||||||
|
|
||||||
if ($agent_cache === false) {
|
if ($agent_cache === false) {
|
||||||
returnError('id_not_found', 'string');
|
returnError('id_not_found', 'string');
|
||||||
return;
|
return;
|
||||||
@ -12418,12 +12435,6 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
|||||||
$values['custom_data'] = '';
|
$values['custom_data'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][17] != '') {
|
|
||||||
$values['server_id'] = $other['data'][17];
|
|
||||||
} else {
|
|
||||||
$values['server_id'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($other['data'][18] != '') {
|
if ($other['data'][18] != '') {
|
||||||
$values['id_extra'] = $other['data'][18];
|
$values['id_extra'] = $other['data'][18];
|
||||||
$sql_validation = 'SELECT id_evento FROM tevento where estado IN (0,2) and id_extra ="'.$other['data'][18].'";';
|
$sql_validation = 'SELECT id_evento FROM tevento where estado IN (0,2) and id_extra ="'.$other['data'][18].'";';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user