Class: Inspec::Resources::Users

Inherits:
Object
  • Object
show all
Includes:
UserManagementSelector
Defined in:
lib/inspec/resources/users.rb

Overview

The InSpec users resources looksup all local users available on a system. TODO: the current version of the users resource will use eg. /etc/passwd on Linux to parse all usernames. Therefore the resource may not return users managed on other systems like LDAP/ActiveDirectory. Please open a feature request at github.com/chef/inspec if you need that functionality

This resource allows complex filter mechanisms

describe users.where(uid: 0).entries do

it { should eq ['root'] }
its('uids') { should eq [1234] }
its('gids') { should eq [1234] }

end

describe users.where { uid =~ /S-1-5-21-d+-d+-d+-500/ } do

it { should exist }

end

Instance Method Summary collapse

Methods included from UserManagementSelector

#select_user_manager

Constructor Details

#initializeUsers

Returns a new instance of Users.



67
68
69
70
71
# File 'lib/inspec/resources/users.rb', line 67

def initialize
  # select user provider
  @user_provider = select_user_manager(inspec.os)
  return skip_resource "The `users` resource is not supported on your OS yet." if @user_provider.nil?
end

Instance Method Details

#to_sObject



90
91
92
# File 'lib/inspec/resources/users.rb', line 90

def to_s
  "Users"
end