0
votes

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 ?

1

1 Answers

0
votes

OK, solved it rather silly. A typo in the ROLE_SONTATA_ADMIN_STUDIES_LIST, corrected it to ROLE_SONATA_ADMIN_STUDIES.

However, the for the admin user, still had to provide ROLE_ADMIN additionally.