Reputation: 3580
I'm using Symfony2 with sonataAdminBundle, sonataUserBundle and FOSUserBundle. I would like to create a new role e.g. ROLE_TEST. When I go to edit a user in the admin CRUD interface, I would like that role to appear in the 'roles' section so I can add it to the user.
Where do I define the role so it appears in that list?
Upvotes: 1
Views: 965
Reputation: 2464
You can add these roles under the ROLE_ADMIN role (or to whatever role the logged in admin user is member of) in the role hierarchy.
# app/config/security.yml
security:
role_hierarchy:
ROLE_ADMIN: [ROLE_USER, ROLE_TEST]
Upvotes: 1