diff --git a/src/KekRozsak/SecurityBundle/Entity/Role.php b/src/KekRozsak/SecurityBundle/Entity/Role.php index 4be7ace..25fae37 100644 --- a/src/KekRozsak/SecurityBundle/Entity/Role.php +++ b/src/KekRozsak/SecurityBundle/Entity/Role.php @@ -4,6 +4,7 @@ namespace KekRozsak\SecurityBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Security\Core\Role\RoleInterface; +use Symfony\Component\Security\Core\Role\Role as SymfonyRole; /** * KekRozsak\SecurityBundle\Entity\Role @@ -11,7 +12,7 @@ use Symfony\Component\Security\Core\Role\RoleInterface; * @ORM\Entity * @ORM\Table(name="roles") */ -class Role implements RoleInterface +class Role extends SymfonyRole implements RoleInterface { /** * The ID of the Role diff --git a/src/KekRozsak/SecurityBundle/Service/RoleHierarchy.php b/src/KekRozsak/SecurityBundle/Service/RoleHierarchy.php index 7fcfcbf..156bf97 100644 --- a/src/KekRozsak/SecurityBundle/Service/RoleHierarchy.php +++ b/src/KekRozsak/SecurityBundle/Service/RoleHierarchy.php @@ -24,19 +24,15 @@ class RoleHierarchy implements RoleHierarchyInterface { $reachableRoles = array(); foreach ($roles as $role) { - if ($role instanceof RoleInterface) { - $thisRole = $role->getRole(); - } else { - $thisRole = $role; - } + $thisRole = $role->getRole(); if (!isset($this->map[$thisRole])) { continue; } - $reachableRoles[] = $thisRole; + $reachableRoles[] = $role; foreach ($this->map[$thisRole] as $r) { if (($childRole = $this->roleRepo->findOneByName($r)) !== null) { - $reachableRoles[] = $childRole->getRole(); + $reachableRoles[] = $childRole; } } }