Untested login

This commit is contained in:
Nicolò P. 2024-12-19 10:18:02 +01:00
parent 615a516ac2
commit ef9eecfdea
2 changed files with 19 additions and 2 deletions

View File

@ -0,0 +1,18 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class SecurityController extends AbstractController
{
#[Route('/login', name: 'app_login')]
public function index(): Response
{
return $this->json([
$this->getUser()?->getId() ?? null
]);
}
}

View File

@ -16,8 +16,7 @@ use Symfony\Component\Serializer\Attribute\Groups;
operations: [ operations: [
new Get(normalizationContext: ['groups' => 'building:item']), new Get(normalizationContext: ['groups' => 'building:item']),
new GetCollection(normalizationContext: ['groups' => 'building:list']), new GetCollection(normalizationContext: ['groups' => 'building:list']),
// TODO Security!! new Post(security: "is_granted('ROLE_USER')"),
new Post(),
], ],
order: ['name' => 'DESC'], order: ['name' => 'DESC'],
paginationEnabled: false, paginationEnabled: false,