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%}
-

Projets

+
+

Mes Projets

+ +
+
@@ -43,7 +45,7 @@
{% for project in projects %} {% if is_granted('VIEW', project) %} -
+
{{project.title}}
@@ -95,20 +97,20 @@
-

Groupes

+
+

Groupes

+ +
@@ -121,7 +123,7 @@
{% for group in groups %} {% if is_granted('VIEW', group) %} -
+
{{group.title}}
@@ -156,7 +158,6 @@ {% endblock %} -