Method: Inspec::Resources::AixUser#identity

Defined in:
lib/resources/user.rb

#identity(username) ⇒ Object



293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/resources/user.rb', line 293

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