mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add endpoint whoami
This commit is contained in:
parent
aaa9a1ec7b
commit
abe012de60
@ -3,8 +3,25 @@
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class UserApiController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @Route(
|
||||
* "/api/1.0/main/whoami.{_format}",
|
||||
* name="chill_main_user_whoami",
|
||||
* requirements={
|
||||
* "_format": "json"
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
public function whoami($_format): JsonResponse
|
||||
{
|
||||
return $this->json($this->getUser(), JsonResponse::HTTP_OK, [],
|
||||
[ "groups" => [ "read" ] ]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -448,6 +448,14 @@ paths:
|
||||
responses:
|
||||
200:
|
||||
description: "ok"
|
||||
/1.0/main/whoami.json:
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Return the currently authenticated user
|
||||
responses:
|
||||
200:
|
||||
description: "ok"
|
||||
/1.0/main/user/{id}.json:
|
||||
get:
|
||||
tags:
|
||||
|
Loading…
x
Reference in New Issue
Block a user