Class: Conjur::Policy::Executor::Base

Inherits:
Object
  • Object
show all
Includes:
Escape, Logger
Defined in:
lib/conjur/policy/executor/base.rb

Overview

Builds a list of execution actions for a statement. The statement is an object from Conjur::Policy::Types. Each execution action is an HTTP method, a request path, and request parameters.

Direct Known Subclasses

Create, Deny, Give, Grant, Permit, Retire, Revoke, Update

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger

included

Constructor Details

#initialize(api, statement, actions) ⇒ Base

Returns a new instance of Base.



14
15
16
17
18
# File 'lib/conjur/policy/executor/base.rb', line 14

def initialize api, statement, actions
  @api = api
  @statement = statement
  @actions = actions
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



12
13
14
# File 'lib/conjur/policy/executor/base.rb', line 12

def actions
  @actions
end

#apiObject (readonly)

Returns the value of attribute api.



12
13
14
# File 'lib/conjur/policy/executor/base.rb', line 12

def api
  @api
end

#statementObject (readonly)

Returns the value of attribute statement.



12
13
14
# File 'lib/conjur/policy/executor/base.rb', line 12

def statement
  @statement
end

Instance Method Details

#action(obj) ⇒ Object



20
21
22
# File 'lib/conjur/policy/executor/base.rb', line 20

def action obj
  @actions.push obj
end

#executeObject



24
25
26
# File 'lib/conjur/policy/executor/base.rb', line 24

def execute
  raise "execute not implemented in #{self.class.name}"
end

#resource_path(record = nil) ⇒ Object



28
29
30
31
# File 'lib/conjur/policy/executor/base.rb', line 28

def resource_path record = nil
  record ||= self.statement
  [ "authz", record., "resources", record.resource_kind, path_escape(record.id) ].join('/')
end

#role_path(record = nil) ⇒ Object



33
34
35
36
# File 'lib/conjur/policy/executor/base.rb', line 33

def role_path record = nil
  record ||= self.statement
  [ "authz", record., "roles", record.role_kind, path_escape(record.id) ].join('/')
end