Method: Inspec::Resources::AixUser#identity

Defined in:
lib/resources/users.rb

#identity(username) ⇒ Object



446
447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/resources/users.rb', line 446

def identity(username)
  id = super(username)
  return nil if id.nil?
  # AIX 'id' command doesn't include the primary group in the supplementary

  # yet it can be somewhere in the supplementary list if someone added root

  # to a groups list in /etc/group

  # we rearrange to expected list if that is the case

  if id[:groups].first != id[:group]
    id[:groups].reject! { |i| i == id[:group] } if id[:groups].include?(id[:group])
    id[:groups].unshift(id[:group])
  end

  id
end