Gem Version Build Status Code Climate Coverage Status

ActsAsRoleable

Adds role based authorization to Rails using the lovely RoleModel and the scopes of Canard. No Authorization, just roles.

Installation

Add this line to your application's Gemfile:

gem 'acts_as_roleable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install acts_as_roleable

Usage

Let's say you have a User model that you want to add roles to. Just use the extend ActsAsRoleable::Roleatize method, and then use acts_as_roleable method. Example below:

class User < ActiveRecord::Base
  extend ActsAsRoleable::Roleatize

  acts_as_roleable roles: [:tester, :user, :owner]
end

And be sure to add a roles_mask:integer column to the associated table. You can change the name of this column by passing the roles_mask attribute:

acts_as_roleable roles: [:tester, :user, :owner], roles_mask: :internal_mask

Contributing

  1. Fork it (http://github.com/<my-github-username>/acts_as_roleable/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request