Class: Verifica::ResourceConfiguration

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

Overview

Note:

Use Configuration#register_resource instead of this class directly

Configuration object for resources registered in Authorizer

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource_type, possible_actions, acl_provider) ⇒ ResourceConfiguration

Note:

Use Configuration#register_resource instead of this constructor directly

Returns a new instance of ResourceConfiguration.

See Also:



32
33
34
35
36
37
38
39
40
# File 'lib/verifica/resource_configuration.rb', line 32

def initialize(resource_type, possible_actions, acl_provider)
  @resource_type = resource_type.to_sym
  @possible_actions = action_set(possible_actions).freeze
  if acl_provider.nil?
    raise Error, "'#{@resource_type}' resource acl_provider should not be nil"
  end
  @acl_provider = acl_provider
  freeze
end

Instance Attribute Details

#acl_provider#call (readonly)

Returns Access Control List provider for this resource type.

Returns:

  • (#call)

    Access Control List provider for this resource type



26
27
28
# File 'lib/verifica/resource_configuration.rb', line 26

def acl_provider
  @acl_provider
end

#possible_actionsSet<Symbol> (readonly)

Returns set of actions possible for this resource type.

Returns:

  • (Set<Symbol>)

    set of actions possible for this resource type



21
22
23
# File 'lib/verifica/resource_configuration.rb', line 21

def possible_actions
  @possible_actions
end

#resource_typeSymbol (readonly)

Returns type of the resource.

Returns:

  • (Symbol)

    type of the resource



16
17
18
# File 'lib/verifica/resource_configuration.rb', line 16

def resource_type
  @resource_type
end