class Inspec::Resources::Users
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
Public Class Methods
new()
click to toggle source
# 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
Public Instance Methods
to_s()
click to toggle source
# File lib/inspec/resources/users.rb, line 90 def to_s "Users" end
Private Instance Methods
collect_user_details()
click to toggle source
collects information about every user
# File lib/inspec/resources/users.rb, line 102 def collect_user_details @users_cache ||= @user_provider.collect_user_details unless @user_provider.nil? end
list_users()
click to toggle source
method to get all available users
# File lib/inspec/resources/users.rb, line 97 def list_users @username_cache ||= @user_provider.list_users unless @user_provider.nil? end