10000 [Form] Add a new field type for managing Roles · Issue #10212 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Form] Add a new field type for managing Roles #10212
Closed
@jameshalsall

Description

@jameshalsall

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0