如何进行Ruby on Rails授权?
我的社交网络网站遇到这个问题。我想根据会员等级对会员进行授权,如果会员等级低于其他会员,他就不能聊天,也不能看到头像。有没有什么插件可以处理?
I have this problem for my social network website. I want to make an authorization for members based on the member level, if the member's level is below then the others, he can't chat or seeing the profile picture. Is there any plug in that can handle it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
声明性授权。非常强大。肯定会推荐它。瑞恩·贝茨 (Ryan Bates) 甚至还对此进行了精彩的轨道广播。
Declarative Authorization. Very powerful. Would definitely recommend it. There's even an awesome railscast on this by Ryan Bates.
我使用了以下内容(两者都可以在 GitHub 上找到):
CanCan——非常简单且文档齐全。作者是 Railscasts 的 Ryan Bates。它的一个好处是您可以在单个文件中识别您的所有权限。
RESTful_ACL——不那么流行但易于实现。您想要保护的每个模型中都定义了权限。我在 Rails 博客中写了一系列关于实现 RESTful_ACL 的文章:http:// /everydayrails.com/2010/06/16/authorization-restful-acl-1.html
I've used the following (both can be found on GitHub):
CanCan--pretty straightforward and well-documented. The author is Ryan Bates of Railscasts fame. One nice thing about it is you can identify all of your permissions within a single file.
RESTful_ACL--not as popular but easy to implement. Permissions are defined in each model you want to protect. I wrote a series on implementing RESTful_ACL in my Rails blog: http://everydayrails.com/2010/06/16/authorization-restful-acl-1.html
尝试 Aegis - http://www.agileweboperations。 com/role-based-permissions-for-your-ruby-on-rails-application
Try Aegis - http://www.agileweboperations.com/role-based-permissions-for-your-ruby-on-rails-application