From 1bc93af14825338737600e3877855550252519d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 19 Apr 2017 22:28:14 +0200 Subject: [PATCH] add hierarchy in role + translations --- Resources/translations/messages.fr.yml | 1 + Security/Authorization/PersonVoter.php | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index 34ebc0e04..fea668bc4 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -140,6 +140,7 @@ Opening the accompanying period: Ouverture d'une période d'accompagnement CHILL_PERSON_SEE: Voir les personnes CHILL_PERSON_UPDATE: Modifier les personnes CHILL_PERSON_CREATE: Ajouter des personnes +CHILL_PERSON_STATS: Statistiques sur les personnes #period Period closed!: Période clôturée! diff --git a/Security/Authorization/PersonVoter.php b/Security/Authorization/PersonVoter.php index 916966a8a..ad9f0c2a4 100644 --- a/Security/Authorization/PersonVoter.php +++ b/Security/Authorization/PersonVoter.php @@ -22,14 +22,14 @@ namespace Chill\PersonBundle\Security\Authorization; use Chill\MainBundle\Security\Authorization\AbstractChillVoter; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; -use Chill\MainBundle\Security\ProvideRoleInterface; +use Chill\MainBundle\Security\ProvideRoleHierarchyInterface; /** * * * @author Julien Fastré */ -class PersonVoter extends AbstractChillVoter implements ProvideRoleInterface +class PersonVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { const CREATE = 'CHILL_PERSON_CREATE'; const UPDATE = 'CHILL_PERSON_UPDATE'; @@ -86,5 +86,10 @@ class PersonVoter extends AbstractChillVoter implements ProvideRoleInterface { return $this->getSupportedAttributes(); } + + public function getRolesWithHierarchy() + { + return [ 'Person' => $this->getRoles() ]; + } }