Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing docs about switch_user and custom voters #11653

Merged
merged 1 commit into from Jun 4, 2019

Conversation

Projects
None yet
4 participants
@weaverryan
Copy link
Member

commented Jun 3, 2019

@nicolas-grekas caught this. We need to use a custom attribute, instead of relying on ROLE_ALLOWED_TO_SWITCH. Otherwise, it's possible for the RoleVoter to say "Yes! This person does have ROLE_ALLOWED_TO_SWITCH"... but then your custom voter is never called, which would then say "Wait, no, they should not". A bit of an edge case - but this strategy gives the user 100% control, which is generally what we want with voters: only 1 voter should vote, not multiple.

Was introduced originally in 4.1.

@javiereguiluz javiereguiluz added this to the 4.2 milestone Jun 4, 2019

@javiereguiluz

This comment has been minimized.

Copy link
Member

commented Jun 4, 2019

Thanks Ryan.

@javiereguiluz javiereguiluz merged commit 3f2e67d into symfony:4.2 Jun 4, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
symfony SymfonyCloud: Environment deployed
Details

javiereguiluz added a commit that referenced this pull request Jun 4, 2019

minor #11653 Fixing docs about switch_user and custom voters (weaverr…
…yan)

This PR was merged into the 4.2 branch.

Discussion
----------

Fixing docs about switch_user and custom voters

@nicolas-grekas caught this. We need to use a custom attribute, instead of relying on `ROLE_ALLOWED_TO_SWITCH`. Otherwise, it's possible for the `RoleVoter` to say "Yes! This person *does* have `ROLE_ALLOWED_TO_SWITCH`"... but then your custom voter is never called, which would then say "Wait, no, they should not". A bit of an edge case - but this strategy gives the user 100% control, which is generally what we want with voters: only 1 voter should vote, not multiple.

Was introduced originally in 4.1.

Commits
-------

3f2e67d Fixing docs about switch_user and custom voters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.