diff --git a/src/Controller/GroupController.php b/src/Controller/GroupController.php index 8dd02bc..87bf0df 100644 --- a/src/Controller/GroupController.php +++ b/src/Controller/GroupController.php @@ -119,7 +119,7 @@ class GroupController extends AbstractController throw new NotFoundHttpException('La ressource demandée est introuvable.'); } - $attribute = constant(GroupVoter::class.'::MOVE'.$status); + $attribute = constant(GroupVoter::class.'::MOVETO'.$status); $this->denyAccessUnlessGranted($attribute, $group); $group->setStatus(constant(Group::class.'::'.$status)); diff --git a/src/Security/GroupVoter.php b/src/Security/GroupVoter.php index b17b373..ebf190a 100644 --- a/src/Security/GroupVoter.php +++ b/src/Security/GroupVoter.php @@ -57,6 +57,8 @@ class GroupVoter extends Voter { $hasUser = $user->hasRole('ROLE_ADMIN') || $user->hasRole('ROLE_MASTER') || $group->getUsers()->contains($user); $hasStatus = Group::ACTIVE === $group->getStatus(); + dump($hasUser); + dump($hasStatus); return $hasUser && $hasStatus; } diff --git a/templates/group/view.html.twig b/templates/group/view.html.twig index 3e22281..2911e25 100644 --- a/templates/group/view.html.twig +++ b/templates/group/view.html.twig @@ -15,8 +15,8 @@ Retour - {% if is_granted('MOVETOINACTIF', group) and group.status=="Actif"%} - + {% if is_granted('MOVETOINACTIVE', group) and group.status=="Actif"%} + Statut = Inactif {% endif %} @@ -26,8 +26,8 @@ Supprimer {% endif %} - {% if is_granted('MOVETOACTIF', group) and group.status=="Inactif" %} - + {% if is_granted('MOVETOACTIVE', group) and group.status=="Inactif" %} + Statut = Actif {% endif %} diff --git a/templates/home/home.html.twig b/templates/home/home.html.twig index 344b278..68ce1ba 100644 --- a/templates/home/home.html.twig +++ b/templates/home/home.html.twig @@ -5,26 +5,28 @@ {%block body%}