diff options
-rw-r--r-- | Core/Authorization/Voter/Voter.php | 1 | ||||
-rw-r--r-- | Core/Role/RoleHierarchy.php | 12 |
2 files changed, 11 insertions, 2 deletions
diff --git a/Core/Authorization/Voter/Voter.php b/Core/Authorization/Voter/Voter.php index ba4d6af..0641486 100644 --- a/Core/Authorization/Voter/Voter.php +++ b/Core/Authorization/Voter/Voter.php @@ -58,6 +58,7 @@ abstract class Voter implements VoterInterface /** * Perform a single access check operation on a given attribute, subject and token. + * It is safe to assume that $attribute and $subject already passed the "supports()" method check. * * @param string $attribute * @param mixed $subject diff --git a/Core/Role/RoleHierarchy.php b/Core/Role/RoleHierarchy.php index 793007e..95e76ee 100644 --- a/Core/Role/RoleHierarchy.php +++ b/Core/Role/RoleHierarchy.php @@ -65,9 +65,17 @@ class RoleHierarchy implements RoleHierarchyInterface } $visited[] = $role; - $this->map[$main] = array_unique(array_merge($this->map[$main], $this->hierarchy[$role])); - $additionalRoles = array_merge($additionalRoles, array_diff($this->hierarchy[$role], $visited)); + + foreach ($this->hierarchy[$role] as $roleToAdd) { + $this->map[$main][] = $roleToAdd; + } + + foreach (array_diff($this->hierarchy[$role], $visited) as $additionalRole) { + $additionalRoles[] = $additionalRole; + } } + + $this->map[$main] = array_unique($this->map[$main]); } } } |