简体   繁体   中英

Edit in list view (role/permissions) in Sonata Admin

I'm looking for a solutions where I can do the following in my Sonata backend:

在此输入图像描述

In my database I have the following tables:

  • roles
    • id
    • name
    • role
    • is_super_admin
    • weight
  • permissions
    • name
    • permissions
    • description
  • role_permission (many to many)
    • role_id
    • permission_id

So I would like to save relations in my table role_permission . But I'm a bit stuck on how to do this in Sonata admin. Can I do this in the list view? And if yes, can you help me on my way?

Not sure if OP wants to implement custom roles or use existing features. However I would recommend using a single role system. Sonata already has handlers for security so in my opinion it would be best to use those instead of creating your own.

On the sonata site, there is a section in the admin bundle about security . Which explains how to setup certain types of role management. I would either go for the Role or ACL handler depending on what you need.

When enabling the role handler you can create groups of roles. These groups would serve as your "Role 1". For example I could create a group called "Beta Testers" and give them the ROLES (permissions) ROLE_CHECK_BETA_CONTENT and ROLE_BETA_FEEDBACK_FORM . Now if you want normal users to not have these rights you could create a normal user group and assign every other role (permission).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM