Sonata Admin 中的角色 [英] Roles in Sonata Admin
问题描述
美好的一天.我不明白如何在奏鸣曲管理包中为用户添加角色.也就是说,在 adminpanel 中看到的具有特定角色的用户只有一个实体并且只与她一起工作是必要的.目前,只有一个角色 - 它是 ROLE_SONATA_ADMIN,它可以访问整个管理面板.在 official site 上找到了这样一个例子:
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]
但我无法理解,而是嵌入 DEMO,而不是 FOO.尝试了很多选择,但没有任何效果.
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.
推荐答案
权限为:
- LIST:查看对象列表
- VIEW:查看一个对象的详细信息
- CREATE:创建一个新对象
- 更新现有对象
- DELETE:删除现有对象
- 导出(用于本地奏鸣曲导出链接)
这篇关于Sonata Admin 中的角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!