-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Add a new field type for managing Roles #10212
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
Comments
Add an option to select only roles reachable by current user using An |
This would be useful. |
If you have any example implementations you can share that would be great, I'm planning on implementing this over the coming weeks. |
I guess the first thing that should be done is implementing a proper role system. Currently symfony itself doesn't know anything about the available roles, it just knows what roles a user has. The role hierarchy isn't complete in this regard: roles outside the hierarchy aren't defined anywhere in symfony. See #17892 for a related discussion, about |
I'm personally using as convention to always list all roles in the hierarchy, even those with no child. |
Symfony's security bundle would provide the hierarchy through the component... |
I am closing here as implementing such a form type requires a list of all possible roles which is not provided by the Security component. |
Something that I think is lacking at the moment is an out-of-the-box "roles" form field type. This would provide the sole purpose of managing an array of roles. The role values could be either strings or
\Symfony\Component\Security\Core\Role\RoleInterface
instances (with this PR I opened a few days ago making comparisons between the two a little easier).I would expect that this is a common problem that people have to tackle in their Symfony applications, and if we didn't want it as part of the core Form component we could provide it as part of the
Symfony\Bridge
.As a set of high level requirements the field could:
choice
field typeSomething has already been achieved in SonataUserBundle here and I implemented a similar solution in one of my own projects last week.
Is this something that would be of use in the Symfony standard distribution?
cc / @webmozart
The text was updated successfully, but these errors were encountered: