Class: Conjur::Policy::Executor::Update

Inherits:
Base show all
Includes:
Annotate
Defined in:
lib/conjur/policy/executor/update.rb

Direct Known Subclasses

UpdateUser

Instance Attribute Summary

Attributes inherited from Base

#actions, #api, #statement

Instance Method Summary collapse

Methods included from Annotate

#annotate, #update_annotation_path

Methods inherited from Base

#action, #initialize, #resource_path, #role_path

Methods included from Logger

included

Constructor Details

This class inherits a constructor from Conjur::Policy::Executor::Base

Instance Method Details

#annotate_recordObject



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

def annotate_record
  record
end

#attribute_namesObject



36
37
38
# File 'lib/conjur/policy/executor/update.rb', line 36

def attribute_names
  record.custom_attribute_names
end

#executeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/conjur/policy/executor/update.rb', line 5

def execute
  attribute_names.each do |attr|
    value = record.send(attr)
    if value
      action({ 
        'method' => 'put',
        'path' => update_path,
        'parameters' => { attr.to_s => value }
      })
    end
  end
  
  annotate
end

#kind_pathObject



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

def kind_path
  record.resource_kind.pluralize
end

#recordObject



32
33
34
# File 'lib/conjur/policy/executor/update.rb', line 32

def record
  statement.record
end

#update_pathObject



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

def update_path
  [ kind_path, fully_escape(statement.record.id) ].join('/')
end