Merge branch 'ent-5827-llamada-a-la-api-de-crear-agentes' into 'develop'

add return error if group = 0 on new agent api

See merge request artica/pandorafms!3212
This commit is contained in:
Daniel Rodriguez 2020-06-11 11:38:26 +02:00
commit b3a588d283
1 changed files with 6 additions and 0 deletions

View File

@ -1506,6 +1506,12 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
return;
}
if ((int) $other['data'][3] == 0) {
$agent_creation_error = __('The agent could not be created, for security reasons use a group another than 0');
returnError('generic error', $agent_creation_error);
return;
}
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $other['data'][0])));
$direccion_agente = io_safe_input($other['data'][1]);
$nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));