minor #15383 [Security] Small optimization in AccessDecisionManager (jderusse)
This PR was merged into the 2.8 branch.
Discussion
----------
[Security] Small optimization in AccessDecisionManager
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | na
| License | MIT
| Doc PR | na
- Remove unused variable `$abstain`
- Remove equals comparison: if not `$grant > $deny` and not `$deny > $grant` then `$grant` equals `$deny`
Commits
-------
0e93463
Small optimization in AccessDecisionManager
This commit is contained in:
commit
1fd70891d3
@ -150,7 +150,6 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
|
||||
{
|
||||
$grant = 0;
|
||||
$deny = 0;
|
||||
$abstain = 0;
|
||||
foreach ($this->voters as $voter) {
|
||||
$result = $voter->vote($token, $object, $attributes);
|
||||
|
||||
@ -163,11 +162,6 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
|
||||
case VoterInterface::ACCESS_DENIED:
|
||||
++$deny;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
++$abstain;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -180,7 +174,7 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($grant == $deny && $grant != 0) {
|
||||
if ($grant > 0) {
|
||||
return $this->allowIfEqualGrantedDeniedDecisions;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user