No release in over 3 years
Low commit activity in last 3 years
Implements CanCanCan's rule-based record fetching using Mongoid.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
>= 1.3
~> 0.8
~> 3.0
~> 10.1
~> 3.2
~> 0.48.1
~> 0.12

Runtime

>= 2.0, < 4
 Project Readme

CanCanCan-Mongoid

Build Status

Code Climate

Mongoid adapter for the CanCanCan authorisation library to automatically generate database queries from ability rules.

Requirements

  • Ruby >= 2.0.0 OR JRuby >= 9.1
  • Mongoid >= 3.0

Usage

In your Gemfile, insert the following line:

gem 'cancancan'
gem 'cancancan-mongoid'

This is it. You can now call accessible_by on any Mongoid document (which is done automatically in the index action).

You can also use the query syntax that Mongoid provides when defining the abilities.

can :read, Article, :priority.lt => 5

This is all done through a Model Adapter. See that page for more information and how you can add your own.

Bugs?

If you find a bug please add an issue on GitHub or fork the project and send a pull request.

Development

This gem uses appraisals to test the code base against multiple versions of Mongoid.

To start developing, run:

bundle install
appraisal install

You can then run all appraisal files (like CI does), with bundle exec appraisal rake or just run a specific set bundle exec appraisal mongoid_6.1 rake.