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

Inherits:
Object
  • Object
show all
Includes:
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(statement, actions) ⇒ Base

Returns a new instance of Base.



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

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

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



9
10
11
# File 'lib/conjur/policy/executor/base.rb', line 9

def actions
  @actions
end

#statementObject (readonly)

Returns the value of attribute statement.



9
10
11
# File 'lib/conjur/policy/executor/base.rb', line 9

def statement
  @statement
end

Instance Method Details

#action(obj) ⇒ Object



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

def action obj
  @actions.push obj
end

#executeObject



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

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

#resource_path(record = nil) ⇒ Object



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

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

#role_path(record = nil) ⇒ Object



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

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