No commit activity in last 3 years
No release in over 3 years
basic and simple roles system for mongoid v3
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.10.0

Runtime

~> 1.6
~> 3.0.3
 Project Readme

mongoid-simple-roles build status

Very basic and simple roles system for mongoid v3. HEAVILY INSPIRED by mongoid-simple-tags

Install

Add the following to Gemfile:

gem "mongoid-simple-roles", "0.0.1"

Usage

Model

class User
  include Mongoid::Document
  include Mongoid::Document::Roleable
end

Console

u = User.create(:name => "Drefined", with_roles: ['superadmin', 'admin', 'user'])

u.roles
=> ['superadmin', 'admin', 'user']

User.find_roles('superadmin')
=> u

u2 = User.new(:name => "Quicksorter")
u2.add_role('admin')
u2.add_role('user')
u2.save

u2.has_role?('admin')
=> true

u2.remove_role('user')
u2.has_role?('user')
=> false

User.find_roles('admin')
=> [u, u2]

Questions or Problems?

If you have any issue or feature request with/for mongoid-simple-roles, please add an issue on GitHub or fork the project and send a pull request.