【问题标题】:Security.yml - State_idSecurity.yml - State_id
【发布时间】:2014-05-19 20:15:51
【问题描述】:

我确实很好地登录了用户。它在 symfony2 中运行良好。在数据库中注册期间,角色和 state_id 将被保存。

role: ROLE_USER
state_id: 4  //e.g. has only permissions to do some extra actions

在 security.yml 中的 symfony2 中是否有一种方法可以向具有角色和 state_id 的目标授予权限?

【问题讨论】:

    标签: security session symfony


    【解决方案1】:

    最好为此使用不同的角色,而不是状态 ID。例如:ROLE_USERROLE_USER_4

    【讨论】:

    • 感谢您的提示。我是这么想的。但我不确定!再次感谢!
    • 别忘了你可以使用role hierarchy,所以ROLE_USER_4角色也会有ROLE_USER角色,但是有一些额外的动作
    猜你喜欢
    • 2015-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-15
    • 1970-01-01
    相关资源
    最近更新 更多