如何在 Symfony2 中制作高级 ACL? [英] How to make advanced ACL in Symfony2?

查看:32
本文介绍了如何在 Symfony2 中制作高级 ACL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要像在 Drupal 中一样编辑角色和权限(根据需要创建更多角色,在网络浏览器中编辑权限,每个模块都可以将自己的权限添加到公共列表中),因为它非常灵活和方便.

我如何在 Symfony2 中实现同样的功能?是否有一些针对此的捆绑包?或者我需要从头开始制作自己的?

解决方案

你可以使用 FOSUserBundle.它包括对创建分配了角色的组的可选支持.然后您可以将用户分配到一个组,他将继承所有这些角色.如果您编辑分配给某个群组的角色,您的更改将级联到属于该群组的所有用户.

使用组的文档在这里:https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/groups.md

I need roles and privileges editing like it is in Drupal (creating as more roles as need, editing privileges in web-browser and each module can add its own privileges to common list), because it very flexibly and handy.

How can i implement same thing in Symfony2? Is there some bundles aimed for this? Or i need make my own from scratch?

解决方案

You can use FOSUserBundle for this. It includes optional support for creating groups which are assigned roles. Then you can assign a user to a group and he will inherit all of those roles. If you edit the roles assigned to a group, your changes will cascade to all users who belong to that group.

Documentation for using groups is here: https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/groups.md

这篇关于如何在 Symfony2 中制作高级 ACL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆