Merge branch 'ent-4852-api-get-the-mc-event-id-from-console-event-id' into 'develop'
Ent 4852 api get the mc event id from console event See merge request artica/pandorafms!3151
This commit is contained in:
commit
3db0f557c9
|
@ -15990,3 +15990,34 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access='A
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function for get event id and node id, then we get in return the Metaconsole event ID.
|
||||||
|
*
|
||||||
|
* @param [string] $server_id id server (Node)
|
||||||
|
* @param [string] $console_event_id console Id node event in tmetaconsole_event
|
||||||
|
* @param [string] $trash2 don't use
|
||||||
|
* @param [string] $returnType
|
||||||
|
*
|
||||||
|
* Example
|
||||||
|
* api.php?op=get&op2=event_mcid&return_type=json&id=0&id2=0&apipass=1234&user=admin&pass=pandora
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function api_get_event_mcid($server_id, $console_event_id, $trash2, $returnType)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
$mc_event_id = db_get_all_rows_sql("SELECT id_evento FROM tmetaconsole_event WHERE id_source_event = $console_event_id AND server_id = $server_id ");
|
||||||
|
if ($mc_event_id !== false) {
|
||||||
|
returnData($returnType, ['type' => 'string', 'data' => $mc_event_id]);
|
||||||
|
} else {
|
||||||
|
returnError('id_not_found', 'string');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
returnError('forbidden', 'string');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue