Class: Conjur::Policy::Executor::UpdateUser
- Includes:
- PublicKeys
- Defined in:
- lib/conjur/policy/executor/update.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from PublicKeys
#attribute_names, #public_key_path
Methods inherited from Update
#annotate_record, #attribute_names, #kind_path, #record, #update_path
Methods included from Annotate
#annotate, #update_annotation_path
Methods inherited from Base
#action, #initialize, #resource_path, #role_path
Methods included from Logger
Constructor Details
This class inherits a constructor from Conjur::Policy::Executor::Base
Instance Method Details
#execute ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/conjur/policy/executor/update.rb', line 44 def execute super if record.public_keys (Array(record.public_keys) - user.public_keys).each do |key| action({ 'method' => 'post', 'path' => public_key_path, 'parameters' => key }) end (user.public_keys - Array(record.public_keys)).each do |key| action({ 'method' => 'delete', 'path' => [ public_key_path, CGI.escape(key_name(key)) ].join('/') }) end end end |
#key_name(key) ⇒ Object
68 69 70 |
# File 'lib/conjur/policy/executor/update.rb', line 68 def key_name key key.split(' ')[-1] end |
#user ⇒ Object
64 65 66 |
# File 'lib/conjur/policy/executor/update.rb', line 64 def user api.user record.id end |