Wip command center, api call node

This commit is contained in:
Daniel Barbero Martin 2021-06-10 14:15:36 +02:00
parent 9e27843b19
commit b4e1c9d61f
2 changed files with 22 additions and 2 deletions

View File

@ -275,7 +275,7 @@ if ($correctLogin) {
break; break;
case 'event': case 'event':
// Preventive check for users if not available write events // Preventive check for users if not available write events.
if (! check_acl($config['id_user'], $event['id_grupo'], 'EW')) { if (! check_acl($config['id_user'], $event['id_grupo'], 'EW')) {
return false; return false;
} }
@ -322,7 +322,10 @@ if ($correctLogin) {
sleep(15); sleep(15);
// Protection on DoS attacks. // Protection on DoS attacks.
echo 'auth error'; returnError(
'auth_error',
$returnType
);
} }
// Logout. // Logout.

View File

@ -108,6 +108,7 @@ function returnError($typeError, $returnType='string')
{ {
switch ($typeError) { switch ($typeError) {
case 'no_set_no_get_no_help': case 'no_set_no_get_no_help':
http_response_code(403);
returnData( returnData(
$returnType, $returnType,
[ [
@ -118,6 +119,7 @@ function returnError($typeError, $returnType='string')
break; break;
case 'no_exist_operation': case 'no_exist_operation':
http_response_code(404);
returnData( returnData(
$returnType, $returnType,
[ [
@ -128,6 +130,7 @@ function returnError($typeError, $returnType='string')
break; break;
case 'id_not_found': case 'id_not_found':
http_response_code(403);
returnData( returnData(
$returnType, $returnType,
[ [
@ -138,6 +141,7 @@ function returnError($typeError, $returnType='string')
break; break;
case 'not_allowed_operation_cluster': case 'not_allowed_operation_cluster':
http_response_code(403);
returnData( returnData(
$returnType, $returnType,
[ [
@ -148,6 +152,7 @@ function returnError($typeError, $returnType='string')
break; break;
case 'forbidden': case 'forbidden':
http_response_code(403);
returnData( returnData(
$returnType, $returnType,
[ [
@ -168,6 +173,7 @@ function returnError($typeError, $returnType='string')
break; break;
case 'centralized': case 'centralized':
http_response_code(403);
returnData( returnData(
$returnType, $returnType,
[ [
@ -177,6 +183,17 @@ function returnError($typeError, $returnType='string')
); );
break; break;
case 'auth_error':
http_response_code(403);
returnData(
$returnType,
[
'type' => 'string',
'data' => __('Auth error'),
]
);
break;
default: default:
returnData( returnData(
$returnType, $returnType,