Description
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:
- Allow the granting / removal of roles (defined by a role hierarchy) to a user
- Prevent users from granting / removing roles that they themselves do not have (optionally)
- Extend the
choice
field type
Something 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