Class Six
In: lib/six.rb
Parent: Object

Methods

Classes and Modules

Class Six::InitializeArgumentError
Class Six::InvalidPackPassed
Class Six::NoPackError

Attributes

current_rule_pack  [R] 
rules_packs  [R] 

Public Class methods

Initialize ability object

Parameters:

packs:A Hash or rules to add with initializtion

Returns:

self

Public Instance methods

Add pack to authorization class w/o key

Parameters:

pack:Any kind of object responding to allowed method

Returns:

true or raise exception

Add pack to authorization class

Parameters:

name:A Symbol declaring the key name of stored pack
pack:Any kind of object responding to allowed method

Returns:

true or false

Same as add_pack but raise exception if pack is invalid

Check if authorization class allow access for object to subject using selected pack or all stored. Basically this method

  1. send :allowed for every stored object in packs and pass object & subject
  2. check if any of results include allowed action

Parameters:

action:Action name to check for access
object:object trying to access resource
subject:resource

Returns:

true or false

Check if authorization class has pack with such name

Parameters:

name:A Symbol declaring the key name of stored pack

Returns:

true or false

Remove pack from authorization class

Parameters:

name:A Symbol declaring the key name of stored pack

Returns:

true or false

Same as remove_pack but raise exception if pack wasnt found

Reset current used rule pack so auth class use global allowed? for new request

Set current pack from stored packs by key

Parameters:

name:A Symbol declaring the key name of stored pack

Returns:

self or false

Same as use but raise exception if no pack found

Check if object for rule pack is valid

Parameters:

pack:Any kind of object responding to allowed method

Returns:

true or false

Protected Instance methods

add(name, pack)

Alias for add_pack

add!(name, pack)

Alias for add_pack!

exist?(name)

Alias for pack_exist?

remove(name)

Alias for remove_pack

remove!(name)

Alias for remove_pack!

reset()

Alias for reset_use

use(name)

Alias for use_pack

use!(name)

Alias for use_pack!

[Validate]