Class: Conjur::Command::Layers

Inherits:
Conjur::Command show all
Defined in:
lib/conjur/command/layers.rb

Class Method Summary collapse

Methods inherited from Conjur::Command

acting_as_option, annotate_option, api, api=, assert_empty, collection_option, command, command_impl_for_list, command_options_for_list, context_option, current_role, current_user, destination_role, display, display_members, elevated?, give_away_resource, has_admin?, hide_docs, highline, integer?, interactive_option, method_missing, min_version, notify_deprecated, prompt_for_annotations, prompt_for_group, prompt_for_id, prompt_for_idnumber, prompt_for_password, prompt_for_public_key, prompt_to_confirm, read_till_eof, require_arg, retire_internal_role, retire_options, retire_resource, retire_role, validate_privileges, validate_public_key, validate_retire_privileges

Methods included from IdentifierManipulation

#conjur_account, #full_resource_id, #get_kind_and_id_from_args

Class Method Details

.interpret_layer_privilege(privilege) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/conjur/command/layers.rb', line 16

def self.interpret_layer_privilege(privilege)
  case privilege
    when 'execute'
      'use_host'
    when 'update'
      'admin_host'
    else
      exit_now! "Invalid privilege '#{privilege}'. Acceptable values are : execute, update"
  end
end

.parse_layer_permission_args(global_options, options, args) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/conjur/command/layers.rb', line 27

def self.parse_layer_permission_args(global_options, options, args)
  id = require_arg(args, "LAYER")
  role = require_arg(args, "ROLE")
  privilege = require_arg(args, "PRIVILEGE")
  role_name = interpret_layer_privilege privilege
  [ id, role_name, role ]
end

.require_hostid_arg(args) ⇒ Object

Form an account:kind:hostid from the host argument Or interpret a fully-qualified role id



8
9
10
11
12
13
14
# File 'lib/conjur/command/layers.rb', line 8

def self.require_hostid_arg(args)
  hostid = require_arg(args, 'HOST')
  unless hostid.index(':')
    hostid = [ Conjur::Core::API., 'host', hostid ].join(':')
  end
  hostid
end