Skip to content

kristianmandrup/cantango-permit_store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Permit Store

CanTango is an advanced Access Control (permissions) system for Rails 3. It:

  • extends CanCan and offers a more role oriented design
  • integrates with role and authentication systems in a non-intrusive manner
  • can cache ability rules between requests for increased performance
  • can store abilites in a permission store, including a YAML file, for easy administration
  • works well with multiple user accounts and sub applications
  • supports multiple Devise users

CanTango Store includes:

  • The generic Permit Store API and functionality
  • Permit store engine implementation
  • Permit store implementations for:
    • YAML file
    • Moneta store

Permit Store API

class CanTango::PermitStore::Base
  def load!
  end

  def save! permits
  end
end
```

The stores included are:

* `CanTango::PermitStore::Yaml`
* `CanTango::PermitStore::Moneta`

## Permit Store Design

The Permit Store loads all the stored permits into a hash, grouped by permit type.
Each permit type is parsed using a `CanTango::PermitStore::Parser::Permits`. 
This parser creates a permit for each entry in the hash using `#parse(key, obj, &blk)`
If the key in the hash indicates a registered mode, then the rules are wrapped in mode specific rules method in the permit. Otherwise they are wrapped in the default `#calc_rules` method.

## Install

`gem install permit_store`

Or insert into Gemfile

`gem 'permit_store'`

Run bundler in a terminal/console from the folder of your Gemfile (root folder of app)

`$ bundle`

## Usage

```ruby
require 'cantango/permit_store'
require 'cantango/permit_store_engine'
```

## Update Nov 19, 2011

Initial extraction of permit_store related functionality. Needs refactoring and testing!
Currently not working. Any help appreciated ;)

About

Permit store for CanTango, including YAML and Moneta variants

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages