bug #30886 [Workflow] Fixed Guard Listener usage of RoleHierarchyInterface (lyrixx)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[Workflow] Fixed Guard Listener usage of RoleHierarchyInterface

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

EUFOSSA

related to https://github.com/symfony/symfony/pull/30388

Commits
-------

a12b359892 [Workflow] Fixed Guard Listener usage of RoleHierarchyInterface
This commit is contained in:
Fabien Potencier 2019-04-06 13:25:08 +02:00
commit a7c4767a8e

View File

@ -97,10 +97,10 @@ class GuardListener
}
if (null !== $this->roleHierarchy && method_exists($this->roleHierarchy, 'getReachableRoleNames')) {
$roleNames = $this->roleHierarchy->getReachableRoleNames($roles);
$roleNames = $this->roleHierarchy->getReachableRoleNames($roleNames);
$roles = array_map(function (string $role) { return new Role($role, false); }, $roleNames);
} elseif (null !== $this->roleHierarchy) {
$roles = $this->roleHierarchy->getReachableRoles($token->getRoles(false));
$roles = $this->roleHierarchy->getReachableRoles($roles);
$roleNames = array_map(function (Role $role) { return $role->getRole(); }, $roles);
}