diff options
author | Nicolas Grekas <nicolas.grekas@gmail.com> | 2016-09-12 21:03:45 +0200 |
---|---|---|
committer | Nicolas Grekas <nicolas.grekas@gmail.com> | 2016-09-12 21:03:45 +0200 |
commit | 52847d3a196e38c482e77edece9b6e317b0023a4 (patch) | |
tree | 33f5944a64067c2562c5fbc38fe8e22fffcc0278 /Core | |
parent | 6685a4f24f977374dcc10bb60a80776db1a6c097 (diff) | |
parent | 63cc48ef437cbd3994ef14f55796f709147c1326 (diff) | |
download | symfony-security-52847d3a196e38c482e77edece9b6e317b0023a4.zip symfony-security-52847d3a196e38c482e77edece9b6e317b0023a4.tar.gz symfony-security-52847d3a196e38c482e77edece9b6e317b0023a4.tar.bz2 |
Merge branch '3.1'
* 3.1:
[travis/appveyor] Wire simple-phpunit
[Console] fixed PHP7 Errors are now handled and converted to Exceptions
Fix #19721
Fix translation:update command count
bumped Symfony version to 2.8.12
updated VERSION for 2.8.11
updated CHANGELOG for 2.8.11
bumped Symfony version to 2.7.19
updated VERSION for 2.7.18
update CONTRIBUTORS for 2.7.18
updated CHANGELOG for 2.7.18
[Security] Optimize RoleHierarchy's buildRoleMap method
[FrameworkBundle] Fix Incorrect line break in exception message (500 debug page)
[Security] Added note inside phpdoc.
Minor cleanups and improvements
[form] lazy trans `post_max_size_message`.
[DI] Fix setting synthetic services on ContainerBuilder
[ClassLoader] Fix ClassCollectionLoader inlining with declare(strict_types=1)
Diffstat (limited to 'Core')
-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]); } } } |