Version

Documentation » User

« 6. User Impersonation

7. Roles Matrix

The Sonata\UserBundle\Form\Type\RolesMatrixType was built to show all roles in a matrix view.

Role matrix

Every admin has defined default roles like:

  • EDIT
  • LIST
  • CREATE
  • VIEW
  • DELETE
  • EXPORT
  • ALL

The roles matrix consists of two parts:

  1. one that shows the matrix with each admin and their permissions.
  2. another that shows the custom roles which are configured in config/packages/security.yaml and lists them as checkboxes (and shows their inherited roles).

Note

The user can just use roles which he is granted.

7.1. How to exclude an admin

You can set the show_in_roles_matrix option to false, like this:

  • YAML
    # config/services.yaml
    
    services:
        app.admin.post:
            class: App\Admin\PostAdmin
            arguments:
                - ~
                - App\Entity\Post
                - ~
            tags:
                -
                    name: sonata.admin
                    manager_type: orm
                    label: 'Post'
                    show_in_roles_matrix: false
    

Found a typo? Something is wrong in this documentation? Just fork and edit it!