6. Roles Matrix¶
Sonata\UserBundle\Form\Type\RolesMatrixType was built to show all
roles in a matrix view.
Every admin has defined default roles like:
The roles matrix consists of two parts:
- one that shows the matrix with each admin and their permissions.
- another that shows the custom roles which are configured in
config/packages/security.yamland lists them as checkboxes (and shows their inherited roles).
The user can just use roles which he is granted.
6.1. How to exclude an admin¶
You can set the
show_in_roles_matrix option to
false, like this:
1 2 3 4 5 6 7 8 9 10 11 12
# config/services.yaml services: app.admin.post: class: App\Admin\PostAdmin tags: - name: sonata.admin model_class: App\Entity\Post manager_type: orm label: 'Post' show_in_roles_matrix: false
6.2. How to exclude roles¶
When using the Form Type, you can use
excluded_roles to not show them in the matrix.
By default, only
ROLE_USER is not shown.