In my Symfony2 project I managed to setup FOSUserBundle + SonataUserBundle + SonataAdminBundle following official docs. Now comes the time to setup the ACL (Access control list).
What I did :
Created an AdminClass called AdminReport
app/console sonata:admin:setup-acl
install ACL for sonata.admin.report update role: ROLE_SONATA_ADMIN_REPORT_GUEST, permissions: ["LIST"] update role: ROLE_SONATA_ADMIN_REPORT_STAFF, permissions: ["LIST","CREATE"] update role: ROLE_SONATA_ADMIN_REPORT_EDITOR, permissions: ["OPERATOR","EXPORT"]
- created a new user, granted him with ROLE_SONATA_ADMIN_REPORT_STAFF
- app/console sonata:admin:generate-object-acl
- Logged in with this user and accessed the default /admin/dashboard
The block containing the AdminReport should appear but it's not... I am missing something ?
Here's my config.yml
sonata_admin: security: handler: sonata.admin.security.handler.acl information: GUEST: [VIEW, LIST] STAFF: [EDIT, LIST, CREATE] EDITOR: [OPERATOR, EXPORT] ADMIN: [MASTER] admin_permissions: [CREATE, LIST, DELETE, UNDELETE, EXPORT, OPERATOR, MASTER] object_permissions: [VIEW, EDIT, DELETE, UNDELETE, OPERATOR, MASTER, OWNER]
EDIT I tried to access directly app_dev.php/admin/app/report/list with this user, and Symfony throws an Access Denied error. Log says
DEBUG - Access denied, the user is neither anonymous, nor remember-me. And if I access app_dev.php/admin/app/report/list it works !
So I tried to change the handler from
sonata.admin.security.handler.aclto
sonata.admin.security.handler.roles
It works because I can see the block in admin dashboard. I also tried to change
access_decision_manager: strategy: unanimousto
affirmativebut it doesn't work...
I am definitely missing something but where ?