Skip to content

Commit 52918a9

Browse files
committed
Added documentation for the priority access decision strategy
1 parent 50236f8 commit 52918a9

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

components/security/authorization.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,17 @@ recognizes several strategies:
4949
``unanimous``
5050
only grant access if none of the voters has denied access;
5151

52+
``priority``
53+
grants or denies access by the first voter that does not abstain;
54+
5255
Usage of the available options in detail::
5356

5457
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
5558

5659
// instances of Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
5760
$voters = [...];
5861

59-
// one of "affirmative", "consensus", "unanimous"
62+
// one of "affirmative", "consensus", "unanimous", "priority"
6063
$strategy = ...;
6164

6265
// whether or not to grant access when all voters abstain

security/voters.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ uses the authorization checker), or by
2626

2727
Ultimately, Symfony takes the responses from all voters and makes the final
2828
decision (to allow or deny access to the resource) according to the strategy defined
29-
in the application, which can be: affirmative, consensus or unanimous.
29+
in the application, which can be: affirmative, consensus, unanimous or priority.
3030

3131
For more information take a look at
3232
:ref:`the section about access decision managers <components-security-access-decision-manager>`.
@@ -262,7 +262,7 @@ checks if the user is a member of the site and a second one that checks if the u
262262
is older than 18.
263263

264264
To handle these cases, the access decision manager uses an access decision
265-
strategy. You can configure this to suit your needs. There are three
265+
strategy. You can configure this to suit your needs. There are four
266266
strategies available:
267267

268268
``affirmative`` (default)
@@ -274,7 +274,11 @@ strategies available:
274274
``unanimous``
275275
This only grants access if there is no voter denying access. If all voters
276276
abstained from voting, the decision is based on the ``allow_if_all_abstain``
277-
config option (which defaults to ``false``).
277+
config option (which defaults to ``false``);
278+
279+
``priority``
280+
This grants or denies access by the first voter that does not abstain,
281+
based on their service priority;
278282

279283
In the above scenario, both voters should grant access in order to grant access
280284
to the user to read the post. In this case, the default strategy is no longer

0 commit comments

Comments
 (0)