+
+ Warning
+ +{{ message }}
+ diff --git a/src/Controller/VocabFuncContextController.php b/src/Controller/VocabFuncContextController.php index 6ea7e5f..cde3520 100644 --- a/src/Controller/VocabFuncContextController.php +++ b/src/Controller/VocabFuncContextController.php @@ -15,6 +15,15 @@ class VocabFuncContextController extends AbstractController #[Route('/vocabs/functional_context', name: 'app_vocab_func_context')] public function index(EntityManagerInterface $em): Response { + $roles = $this->getUser()->getRoles(); + + if (! in_array('ROLE_REVISOR', $roles) + && ! in_array('ROLE_ADMIN', $roles) + ) { + $this->addFlash('warning', 'Only revisors and administrators can edit vocabularies'); + return $this->redirectToRoute('app_home'); + } + $terms = $em->getRepository(VocabFuncContext::class)->findBy([], ['term' => 'ASC']); return $this->render('vocab_func_context/index.html.twig', [ diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index 60bca47..7bed1c6 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -6,10 +6,21 @@