https status must be 400 instead of 200 in case of an error

This commit is contained in:
Uwe Steinmann 2024-11-13 22:31:55 +01:00
parent f5db14dd74
commit f6f7fe0ab6

View File

@ -2346,7 +2346,7 @@ class RestapiController { /* {{{ */
$params = $request->getParsedBody();
if (empty($params['userid'])) {
return $response->withJson(array('success'=>false, 'message'=>'Missing userid', 'data'=>''), 500);
return $response->withJson(array('success'=>false, 'message'=>'Missing userid', 'data'=>''), 400);
}
$userId = $params['userid'];
if(ctype_digit($userId))
@ -2404,9 +2404,9 @@ class RestapiController { /* {{{ */
if($check !== true)
return $check;
$params = $request->getParsedBody();
if (empty($params['enable']))
if (!isset($params['enable']))
{
return $response->withJson(array('success'=>false, 'message'=>'You must supply an "enable" value', 'data'=>''), 200);
return $response->withJson(array('success'=>false, 'message'=>'You must supply an "enable" value', 'data'=>''), 400);
}
$inherit = false;
@ -2474,12 +2474,12 @@ class RestapiController { /* {{{ */
{
if ($params['id'] == null)
{
return $response->withJson(array('success'=>false, 'message'=>'Please PUT the user or group Id', 'data'=>''), 200);
return $response->withJson(array('success'=>false, 'message'=>'Please PUT the user or group Id', 'data'=>''), 400);
}
if ($params['mode'] == null)
{
return $response->withJson(array('success'=>false, 'message'=>'Please PUT the access mode', 'data'=>''), 200);
return $response->withJson(array('success'=>false, 'message'=>'Please PUT the access mode', 'data'=>''), 400);
}
$modeInput = $params['mode'];