I created a custom dashboard block for one of the admin entities called STUDY, a list.
- Security Handler: sonata.admin.security.handler.role
- Roles are stored in the Database for the user. (Groups the user belongs to)
I wish to display this block only when the user has LIST role allowed for the Study admin entity.
my config.yml
dashboard:
blocks:
position: left
type: nzgui.app.block.status,
roles: [ROLE_SONTATA_ADMIN_STUDIES_LIST]
This however does not work, and the block is not shown even for the super admin user.
Looking at the template the roles is being checked using is_granted(role) code call in twig. While in sidebar, the role is being checked using item.extra('admin').isGranted('LIST') and works.
How can I solve this issue ?