8000 Fixing docs about switch_user and custom voters by weaverryan · Pull Request #11653 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Fixing docs about switch_user and custom v 8000 oters #11653

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

Merged
merged 1 commit into from
Jun 4, 2019

Conversation

weaverryan
Copy link
Member

@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
Copy link
Member

Thanks Ryan.

@javiereguiluz javiereguiluz merged commit 3f2e67d into symfony:4.2 Jun 4, 2019
javiereguiluz added a commit that referenced this pull request Jun 4, 2019
…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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0