RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

rolify: roles library with resource scoping

I just released rolify 1.1, this ruby gem provides a simple way to manage different kind of roles in your application. Let say you don’t want just global roles in your application and/or you don’t want them to be hardcoded. Rolify allows you to define 3 role scope levels:

  • global: @user.has_role "admin"
  • class scoped: @user.has_role "moderator", Forum
  • resource scoped: @user.has_role "moderator", Forum.find(3)

rolify doesn’t enforce any authentication/authorization, but it’s flexible enough to be integrated easily with any authentication/authorization library. Here is a tutorial showing how to integrate rolify with CanCan and Devise

Comments

Hi does this work with mongoid?

Hi Nik, sorry for the late response. No it does work only with ActiveRecord so far but you can send a feature and/or a pull request, any contribution appreciated.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in