Class: Racf::Commands::Rlist

Inherits:
AbstractCommand show all
Defined in:
lib/racf/commands/rlist.rb

Constant Summary collapse

NAME_HEADER =
/CLASS\s+NAME/
NO_USERS =
/NO\s+USERS\s+IN\s+ACCESS\s+LIST/
OWNER_HEADER =
/LEVEL\s+OWNER\s+UNIVERSAL\s+ACCESS\s+YOUR\s+ACCESS\s+WARNING/
CONDITIONAL_ACCESS_LIST_HEADER =
/ID\s+ACCESS\s+ACCESS\s+COUNT\s+CLASS\s+ENTITY\s+NAME/

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ Rlist

Returns a new instance of Rlist.



39
40
41
42
43
44
# File 'lib/racf/commands/rlist.rb', line 39

def initialize(session)
  @resources = {}
  @current_resource = {}

  super
end

Instance Method Details

#extract_resources(args) ⇒ Object



82
83
84
85
86
87
88
89
90
91
# File 'lib/racf/commands/rlist.rb', line 82

def extract_resources(args)
  resources = args[1]

  case resources
  when String
    [resources]
  when Array
    resources
  end
end

#run(*args) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/racf/commands/rlist.rb', line 46

def run(*args)
  class_name        = args[0]
  resources_names   = extract_resources_names(args)
  command           = "RLIST #{class_name} (#{resources_names}) AUTHUSER"

  raw_output        = @session.run_command(command)

  @scanner = StringScanner.new(raw_output)
  log_number_of_resources(args[1])

  while @scanner.scan(/(.*?)$\n/)
    case state_name
    when :nothing_processed, :resource_processed
      process_name
    when :name_processed
      case class_name
      when "TIMS"
        process_owner
      when "GIMS"
        process_members
      end
    when :members_processed
      process_owner
    when :owner_processed
      process_users
    when :users_processed
      finish_resource_processing
    end
  end

  resources = @resources
  clear_state

  resources
end