在Rails应用程序中实现ACL的最佳方法是什么?
时间:2020-03-06 14:34:18 来源:igfitidea点击:
我只是想比较在Rails中实现ACL时使用的不同解决方案。
解决方案
有一个名为acl_system2的插件,通过拥有一个用户表和一个角色表来运行。自述文件中有很多有用的信息,该项目也位于github上。
我发现的最好的是role_requirement。它直接插入restful_authentication插件。
我使用授权插件(由Bill Katz创建):
Roles can be authorized for the entire application, a model class, or a specific object. The plugin provides a way of checking authorization at the class or instance method level using permit and permit? methods. It also provides english-like dynamic methods like "user.is_manager_of project" (where "user" acts as authorized, "manager" is a role, and "project" is an authorizable model). You can specify how control is redirected if authorization is denied. (quote source)
主页:
http://www.writertopia.com/developers/authorization
文件:
http://github.com/DocSavage/rails-authorization-plugin/tree/master/authorization/README.rdoc
我们可能也有兴趣阅读此比较信息(从去年开始,但仍然有些用处;这是我从上面获得的报价的来源):
http://www.vaporbase.com/postings/Authorization_in_Rails
以及最近的比较:
http://steffenbartsch.com/blog/2008/08/rails-authorization-plugins/