Very crude permissions
TODO: Use Symfony Voters
This commit is contained in:
@@ -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', [
|
||||
|
||||
Reference in New Issue
Block a user