Added an API endpoint to get the authenticated user (closes #1165)

This commit is contained in:
Bernd Bestel
2020-12-09 21:16:49 +01:00
parent fda8411ab3
commit 48aa9fd138
4 changed files with 51 additions and 4 deletions

View File

@@ -126,6 +126,18 @@ class UsersApiController extends BaseApiController
}
}
public function CurrentUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
return $this->ApiResponse($response, $this->getUsersService()->GetUsersAsDto()->where('id', GROCY_USER_ID));
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function ListPermissions(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try