Class: Conjur::Policy::Executor::Base
- 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.
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#api ⇒ Object
readonly
Returns the value of attribute api.
-
#statement ⇒ Object
readonly
Returns the value of attribute statement.
Instance Method Summary collapse
- #action(obj) ⇒ Object
- #execute ⇒ Object
-
#initialize(api, statement, actions) ⇒ Base
constructor
A new instance of Base.
- #resource_path(record = nil) ⇒ Object
- #role_path(record = nil) ⇒ Object
Methods included from Logger
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
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
12 13 14 |
# File 'lib/conjur/policy/executor/base.rb', line 12 def actions @actions end |
#api ⇒ Object (readonly)
Returns the value of attribute api.
12 13 14 |
# File 'lib/conjur/policy/executor/base.rb', line 12 def api @api end |
#statement ⇒ Object (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 |
#execute ⇒ Object
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.account, "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.account, "roles", record.role_kind, path_escape(record.id) ].join('/') end |