Answer the question
In order to leave comments, you need to log in
How to properly assign roles to groups in FOSUserBundle?
I use FOSUserBundle and the groups built into it, each of which has its own set of roles. The task is to make an administrative interface for assigning roles to groups (from security.role_hierarchy.roles). (I don't use sonata's admin panel generation bundles.) I.e. you need to add a field for multiple choice of roles to the form for creating / editing a group.
What is the right way to do it:
Answer the question
In order to leave comments, you need to log in
Create a RoleType type for the form or something like that, where to form a list of available roles. The list of roles, as far as I remember, is available via DI as security.role_hierarchy.roles and it can be injected directly into the RoleType constructor (use FromType as a service they say).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question