user3395924
user3395924

Reputation: 135

Sonata admin Dashboard Block Roles

I created a custom dashboard block for one of the admin entities called STUDY, a list.

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 ?

Upvotes: 0

Views: 952

Answers (1)

user3395924
user3395924

Reputation: 135

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.

Upvotes: 0

Related Questions