From 6f7bda9f0aaad10f44896b7022e9c7dc86dba904 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 10 Mar 2022 15:15:14 +0100 Subject: [PATCH] indexAction adjusted so that users who are only admin will still go to admin homepage. --- src/Bundle/ChillMainBundle/Controller/DefaultController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Controller/DefaultController.php b/src/Bundle/ChillMainBundle/Controller/DefaultController.php index a83a1f11b..87c1fce91 100644 --- a/src/Bundle/ChillMainBundle/Controller/DefaultController.php +++ b/src/Bundle/ChillMainBundle/Controller/DefaultController.php @@ -20,6 +20,10 @@ class DefaultController extends AbstractController { public function indexAction() { + if ($this->isGranted('ROLE_ADMIN') && !in_array('ROLE_USER',$this->getUser()->getRoles())) { + return $this->redirectToRoute('chill_main_admin_central', [], 302); + } + return $this->render('@ChillMain/layout.html.twig'); }