diff --git a/config/packages/security.yaml b/config/packages/security.yaml index dfae12e..6704c77 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -50,7 +50,7 @@ security: # switch_user: true role_hierarchy: - ROLE_ADMIN: ROLE_ADMIN + ROLE_ADMIN: [ ROLE_ADMIN, ROLE_EMPLOYEE, ROLE_USER ] ROLE_EMPLOYEE: ROLE_EMPLOYEE ROLE_USER: ROLE_USER # Easy way to control access for large sections of your site diff --git a/src/Controller/IndexController.php b/src/Controller/IndexController.php index c1ad21b..356aa94 100644 --- a/src/Controller/IndexController.php +++ b/src/Controller/IndexController.php @@ -2,6 +2,7 @@ namespace App\Controller; +use App\Entity\UserApp; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; @@ -11,7 +12,9 @@ class IndexController extends AbstractController #[Route('/index', name: 'app_index')] public function index(): Response { - return $this->render('index/index.html.twig', []); + return $this->render('index/index.html.twig', [ + 'id' => $this->getUser()->getId(), + ]); } #[Route('/test', name: 'app_test')] diff --git a/src/Controller/UserAppController.php b/src/Controller/UserAppController.php index f6e8161..7a74e73 100644 --- a/src/Controller/UserAppController.php +++ b/src/Controller/UserAppController.php @@ -11,7 +11,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; -#[Route('/user/app')] +#[Route('/user')] final class UserAppController extends AbstractController { #[Route(name: 'app_user_app_index', methods: ['GET'])] @@ -22,25 +22,25 @@ final class UserAppController extends AbstractController ]); } - #[Route('/new', name: 'app_user_app_new', methods: ['GET', 'POST'])] - public function new(Request $request, EntityManagerInterface $entityManager): Response - { - $userApp = new UserApp(); - $form = $this->createForm(UserAppType::class, $userApp); - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - $entityManager->persist($userApp); - $entityManager->flush(); - - return $this->redirectToRoute('app_user_app_index', [], Response::HTTP_SEE_OTHER); - } - - return $this->render('user_app/new.html.twig', [ - 'user_app' => $userApp, - 'form' => $form, - ]); - } +// #[Route('/new', name: 'app_user_app_new', methods: ['GET', 'POST'])] +// public function new(Request $request, EntityManagerInterface $entityManager): Response +// { +// $userApp = new UserApp(); +// $form = $this->createForm(UserAppType::class, $userApp); +// $form->handleRequest($request); +// +// if ($form->isSubmitted() && $form->isValid()) { +// $entityManager->persist($userApp); +// $entityManager->flush(); +// +// return $this->redirectToRoute('app_user_app_index', [], Response::HTTP_SEE_OTHER); +// } +// +// return $this->render('user_app/new.html.twig', [ +// 'user_app' => $userApp, +// 'form' => $form, +// ]); +// } #[Route('/{id}', name: 'app_user_app_show', methods: ['GET'])] public function show(UserApp $userApp): Response diff --git a/templates/base.html.twig b/templates/base.html.twig index 80c70db..dca9b2b 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -31,11 +31,13 @@ À propos de nous Nous contacter + {% if app.user %}
+ {% endif %} diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig index fb7733c..ca74689 100644 --- a/templates/security/login.html.twig +++ b/templates/security/login.html.twig @@ -8,9 +8,9 @@
Pas encore inscrit ? Inscrivez vous !!
- En tant que Stagiaire
+ En tant que stagiaire
- En tant qu'Entreprise
+ En tant qu'entreprise
Nom d'utilisateur :
+{{ user_app.nickname }}
+Rôles :
+{{ user_app.roles ? user_app.roles|json_encode : '' }}
+Prénom :
+{{ user_app.firstName }}
+Nom :
+{{ user_app.lastName }}
+Téléphone :
+{{ user_app.tel }}
+Addresse :
+{{ user_app.address }}
+Mail :
+{{ user_app.mail }}
+Id | -{{ user_app.id }} | -
---|---|
Nickname | -{{ user_app.nickname }} | -
Roles | -{{ user_app.roles ? user_app.roles|json_encode : '' }} | -
Password | -{{ user_app.password }} | -
FirstName | -{{ user_app.firstName }} | -
LastName | -{{ user_app.lastName }} | -
Tel | -{{ user_app.tel }} | -
Address | -{{ user_app.address }} | -
{{ user_app.mail }} | -