I successfully setup sonata admin bundle with acl editor. I am easily able to set user wise permission on object as well as roles users using acl editor. but when i trying to login using particular role then i cannot see in sidebar menu which i permitted to particular role.
e.g
i have roles like ROLE_MASTER_ADMIN, ROLE_SUPER_ADMIN, ROLE_VENDOR, ROLE_RETAILER. i have set two menu for now using USERBUNDLE i.e. users and group. which is shown for two roles ROLE_MASTER_ADMIN, ROLE_SUPER_ADMIN with full list, edit, delete, undelete, operator, master and owner permissions.
Then i set permissions for ROLE_VENDOR which has access of users list, edit, delete and undelete. same as i set permission for ROLE_RETAILER which has access of groups list, edit, delete and undelete.
after login with ROLE_VENDOR, ROLE_RETAILER users i am not able to see anything in sidebar menu.
i need help to implement this. thanks in advance.
this is what i set in my config.yml file
sonata_admin:
dashboard:
groups:
sonata_user:
label: sonata_user
label_catalogue: SonataUserBundle
icon: '<i class="fa fa-users"></i>'
items:
-
admin: sonata.user.admin.user
route: admin_sonata_user_user_list
label: users
roles: ['ROLE_MASTER_ADMIN', 'ROLE_SUPER_ADMIN', 'ROLE_VENDOR']
-
admin: sonata.user.admin.group
route: admin_sonata_user_group_list
label: groups
roles: ['ROLE_MASTER_ADMIN', 'ROLE_SUPER_ADMIN', 'ROLE_RETAILER']
roles: ['ROLE_MASTER_ADMIN', 'ROLE_SUPER_ADMIN', 'ROLE_VENDOR', 'ROLE_RETAILER']
but it shows me error like below:
An exception has been thrown during the rendering of a template ("Warning: get_class() expects parameter 1 to be object, string given").
UPDATED Command Output
=> php app/console sonata:admin:generate-object-acl
Welcome to the AdminBundle object ACL generator
This command helps you to generate ACL entities for the objects handled by the AdminBundle.
If the step option is used, you will be asked if you want to generate the object ACL entities for each Admin. You must use the shortcut notation like AcmeDemoBundle:User if you want to set an object owner.
generate ACLs for sonata.user.admin.user
[TOTAL] generated class ACEs for 4 objects (added 0, updated 4)
generate ACLs for sonata.user.admin.group
[TOTAL] generated class ACEs for 0 objects (added 0, updated 0)
=> php app/console sonata:admin:setup-acl
Starting ACL AdminBundle configuration
install ACL for sonata.user.admin.user
update role: ROLE_SONATA_USER_ADMIN_USER_ROLE_RETAILER, permissions: ["LIST"]
update role: ROLE_SONATA_USER_ADMIN_USER_ROLE_VENDOR, permissions: ["LIST","EDIT","CREATE"]
update role: ROLE_SONATA_USER_ADMIN_USER_ROLE_MASTER_ADMIN, permissions: ["MASTER"]
install ACL for sonata.user.admin.group
update role: ROLE_SONATA_USER_ADMIN_GROUP_ROLE_RETAILER, permissions: ["LIST"]
update role: ROLE_SONATA_USER_ADMIN_GROUP_ROLE_VENDOR, permissions: ["LIST","EDIT","CREATE"]
update role: ROLE_SONATA_USER_ADMIN_GROUP_ROLE_MASTER_ADMIN, permissions: ["MASTER"]