Sha256: cff153028afaa4392c23b2c4edfd98109838d82a58670b43c0cfcc9f1b4272bd

Contents?: true

Size: 1.7 KB

Versions: 22

Compression:

Stored size: 1.7 KB

Contents

h2. Permission store

The Permission store is basically a key-value store. Each top level key is a type of permission:
The types are:
* roles
* role_groups
* licenses

Note that licenses are just named subsets of rules and can thus be reused for oth roles and role_groups.

roles:
  blogger:
    can:
    cannot:
    author:
      Comment:
        can:
role_groups:
  admins:
    can:
licenses:
  editors:
    can:

If using a Yaml store, the default file name is: config/tango_permissions.yml

h2. User Permission store

stan@theman.com:
  can:
  cannot:
  owner:
    Comment:
      can:

If using a Yaml store, the default file name is: config/tango_user_permissions.yml

h2. Categories store

The categories store can be used to define categories of classes that can be acted upon in the same way.

articles: [Blog, Post]
roles: [Role, RoleGroup]

If using a Yaml store, the default file name is: config/tango_categories.yml

All access to a store must go through a CanTango::Permission::Store class.

h2. Caching and loading

When a store is loaded, all permissions are parsed and evaluated as CanCan rules and cached under the specific key.

Cache
  roles:
    bloggers: [rules]
  role_groups:
    admins: [rules]

CanTango.permission_store.cache(:roles).rules_for(:bloggers)

When a store is saved, the Cache for that store must be invalidated and the rules rebuilt.

CanTango.permission_store.save! permissions

CanTango.permission_store.cache.invalidate!

h2. Permissions

CanTango::Permission uses a Hashie to store the rules

* name
* rules [Hashie]

@stanislaw: let the name and #rules content will have string keys, not symbols.
Hashie::Mash uses strings, and for us this convention is good for lib & spec stuff consistency.

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
cantango-0.9.4.7 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.9.4.6 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.9.4.5 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.9.4.3 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.9.4.2 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.9.4.1 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.9.4 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.9.3.2 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.8.9.5 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.8.9.4 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.8.9.3 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.8.9.2 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.8.9.1 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.8.9 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.8.8.1 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.8.8 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.8.7 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.8.6.2 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.8.6.1 spec/cantango/permission_engine/PERMISSION_STORE.textile
cantango-0.8.6 spec/cantango/permission_engine/PERMISSION_STORE.textile