diff options
Diffstat (limited to 'Core/Authorization/Voter')
-rw-r--r-- | Core/Authorization/Voter/RoleVoter.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Core/Authorization/Voter/RoleVoter.php b/Core/Authorization/Voter/RoleVoter.php index b017c81..d5f3176 100644 --- a/Core/Authorization/Voter/RoleVoter.php +++ b/Core/Authorization/Voter/RoleVoter.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Security\Core\Authorization\Voter; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Role\RoleInterface; /** * RoleVoter votes if any attribute starts with a given prefix. @@ -41,7 +42,11 @@ class RoleVoter implements VoterInterface $roles = $this->extractRoles($token); foreach ($attributes as $attribute) { - if (0 !== strpos($attribute, $this->prefix)) { + if ($attribute instanceof RoleInterface) { + $attribute = $attribute->getRole(); + } + + if (!is_string($attribute) || 0 !== strpos($attribute, $this->prefix)) { continue; } |