You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 5.4:
Be more precise about the required Composer version
[Security] Implement ADM strategies as dedicated classes
Bump Symfony version to 5.3.11
Update VERSION for 5.3.10
Update CHANGELOG for 5.3.10
if ('' === $strategy || !\is_callable([$this, $strategyMethod])) {
51
-
thrownew \InvalidArgumentException(sprintf('The strategy "%s" is not supported.', $strategy));
73
+
$this->voters = $voters;
74
+
if (\is_string($strategy)) {
75
+
trigger_deprecation('symfony/security-core', '5.4', 'Passing the access decision strategy as a string is deprecated, pass an instance of "%s" instead.', AccessDecisionStrategyInterface::class);
thrownew \TypeError(sprintf('"%s": Parameter #2 ($strategy) is expected to be an instance of "%s" or null, "%s" given.', __METHOD__, AccessDecisionStrategyInterface::class, get_debug_type($strategy)));
if (!\is_int($result) || !(self::VALID_VOTES[$result] ?? false)) {
94
114
thrownew \LogicException(sprintf('"%s::vote()" must return one of "%s" constants ("ACCESS_GRANTED", "ACCESS_DENIED" or "ACCESS_ABSTAIN"), "%s" returned.', get_debug_type($voter), VoterInterface::class, var_export($result, true)));
95
115
}
96
-
}
97
116
98
-
if ($deny > 0) {
99
-
returnfalse;
117
+
yield$result;
100
118
}
101
-
102
-
return$this->allowIfAllAbstainDecisions;
103
119
}
104
120
105
121
/**
106
-
* Grants access if there is consensus of granted against denied responses.
107
-
*
108
-
* Consensus means majority-rule (ignoring abstains) rather than unanimous
109
-
* agreement (ignoring abstains). If you require unanimity, see
110
-
* UnanimousBased.
111
-
*
112
-
* If there were an equal number of grant and deny votes, the decision will
113
-
* be based on the allowIfEqualGrantedDeniedDecisions property value
114
-
* (defaults to true).
115
-
*
116
-
* If all voters abstained from voting, the decision will be based on the
117
-
* allowIfAllAbstainDecisions property value (defaults to false).
122
+
* @throws \InvalidArgumentException if the $strategy is invalid
thrownew \LogicException(sprintf('"%s::vote()" must return one of "%s" constants ("ACCESS_GRANTED", "ACCESS_DENIED" or "ACCESS_ABSTAIN"), "%s" returned.', get_debug_type($voter), VoterInterface::class, var_export($result, true)));
thrownew \LogicException(sprintf('"%s::vote()" must return one of "%s" constants ("ACCESS_GRANTED", "ACCESS_DENIED" or "ACCESS_ABSTAIN"), "%s" returned.', get_debug_type($voter), VoterInterface::class, var_export($result, true)));
171
-
}
172
-
}
173
-
}
174
-
175
-
// no deny votes
176
-
if ($grant > 0) {
177
-
returntrue;
178
-
}
179
-
180
-
return$this->allowIfAllAbstainDecisions;
137
+
thrownew \InvalidArgumentException(sprintf('The strategy "%s" is not supported.', $strategy));
181
138
}
182
139
183
140
/**
184
-
* Grant or deny access depending on the first voter that does not abstain.
185
-
* The priority of voters can be used to overrule a decision.
186
-
*
187
-
* If all voters abstained from voting, the decision will be based on the
188
-
* allowIfAllAbstainDecisions property value (defaults to false).
thrownew \LogicException(sprintf('"%s::vote()" must return one of "%s" constants ("ACCESS_GRANTED", "ACCESS_DENIED" or "ACCESS_ABSTAIN"), "%s" returned.', get_debug_type($voter), VoterInterface::class, var_export($result, true)));
0 commit comments