I have a Symfony 5.4 project using sonata-project/admin-bundle
4.9 and sonata-project/user-bundle
5.0.0-rc.1 and I want to let only the users with role ROLE_ADMIN
to manage the users (CREATE/LIST/EDIT/DELETE), for other roles I want to hide the navbar menu entry and the dashboard entry for "Users".
In my config/packages/sonata_admin.yml
I tried to specify a sonata.user.block.menu
entry as found in some old questions but it seems that it does not exists anymore as the following error is thrown:
An exception has been thrown during the rendering of a template ("The block type "sonata.user.block.menu" does not exist").
As default I had only one admin_list block, I tried adding a sonata.block.service.rss and it is shown correctly in the dashboard but I can't find how to manage the Users block.
sonata_admin:
title: 'Sonata Admin'
dashboard:
blocks:
- { type: sonata.admin.block.admin_list, position: left }
#- { type: sonata.user.block.menu, position: right, roles: [ROLE_ADMIN]}
#- { type: sonata.block.service.rss, position: right, roles: [ROLE_ADMIN]}
templates:
layout: sonataLayout.html.twig
sonata_block:
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
Any hints? Explicative picture following.