8000 minor #15383 [Security] Small optimization in AccessDecisionManager (… · symfony/symfony@1fd7089 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1fd7089

Browse files
committed
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
2 parents 96e211d + 0e93463 commit 1fd7089

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ private function decideConsensus(TokenInterface $token, array $attributes, $obje
150150
{
151151
$grant = 0;
152152
$deny = 0;
153-
$abstain = 0;
154153
foreach ($this->voters as $voter) {
155154
$result = $voter->vote($token, $object, $attributes);
156155

@@ -163,11 +162,6 @@ private function decideConsensus(TokenInterface $token, array $attributes, $obje
163162
case VoterInterface::ACCESS_DENIED:
164163
++$deny;
165164

166-
break;
167-
168-
default:
169-
++$abstain;
170-
171165
break;
172166
}
173167
}
@@ -180,7 +174,7 @@ private function decideConsensus(TokenInterface $token, array $attributes, $obje
180174
return false;
181175
}
182176

183-
if ($grant == $deny && $grant != 0) {
177+
if ($grant > 0) {
184178
return $this->allowIfEqualGrantedDeniedDecisions;
185179
}
186180

0 commit comments

Comments
 (0)
0