Class: Verifica::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/verifica/configuration.rb

Overview

Configuration object for Authorizer, holds list of registered resources and other params

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Note:

Use Verifica.authorizer instead of this constructor directly

Returns a new instance of Configuration.



20
21
22
# File 'lib/verifica/configuration.rb', line 20

def initialize
  @resources = []
end

Instance Attribute Details

#resourcesArray<ResourceConfiguration> (readonly)

Returns array of registered resources.

Returns:



15
16
17
# File 'lib/verifica/configuration.rb', line 15

def resources
  @resources
end

Instance Method Details

#register_resource(type, possible_actions, acl_provider) ⇒ self

Register a new resource supported by Authorizer

Parameters:

  • type (Symbol, String)

    type of the resource

  • possible_actions (Enumerable<Symbol>, Enumerable<String>)

    list of actions possible for this resource type

  • acl_provider (#call)

    Access Control List provider for this resource type. Could be any object that responds to #call(resource, **) and returns Acl

Returns:

  • (self)

See Also:



36
37
38
39
# File 'lib/verifica/configuration.rb', line 36

def register_resource(type, possible_actions, acl_provider)
  resources << ResourceConfiguration.new(type, possible_actions, acl_provider)
  self
end