问题
Good day. I can not understand how in sonata admin bundle to add roles to users. Namely, it is necessary that the user with a specific role seen in adminpanel only one entity and only worked with her. For now, there is only one role - it ROLE_SONATA_ADMIN, which gives access to the whole adminpanel. On official site found just such an example :
security:
...
role_hierarchy:
# for convenience, I decided to gather Sonata roles here
ROLE_SONATA_FOO_READER:
- ROLE_SONATA_ADMIN_DEMO_FOO_LIST
- ROLE_SONATA_ADMIN_DEMO_FOO_VIEW
ROLE_SONATA_FOO_EDITOR:
- ROLE_SONATA_ADMIN_DEMO_FOO_CREATE
- ROLE_SONATA_ADMIN_DEMO_FOO_EDIT
ROLE_SONATA_FOO_ADMIN:
- ROLE_SONATA_ADMIN_DEMO_FOO_DELETE
- ROLE_SONATA_ADMIN_DEMO_FOO_EXPORT
# those are the roles I will use (less verbose)
ROLE_STAFF: [ROLE_USER, ROLE_SONATA_FOO_READER]
ROLE_ADMIN: [ROLE_STAFF, ROLE_SONATA_FOO_EDITOR, ROLE_SONATA_FOO_ADMIN]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
But I can not understand that instead embed DEMO, and that instead of FOO. Tried a lot of options but nothing is worked.
Thanks in advance and sorry for my bad English.
回答1:
The permissions are:
- LIST: view the list of objects
- VIEW: view the detail of one object
- CREATE: create a new object
- EDIT: update an existing object
- DELETE: delete an existing object
- EXPORT (for the native Sonata export links)
来源:https://stackoverflow.com/questions/22380625/roles-in-sonata-admin