Class: Specinfra::Command::Windows::Base::User

Inherits:
Specinfra::Command::Windows::Base show all
Defined in:
lib/specinfra/command/windows/base/user.rb

Class Method Summary collapse

Methods inherited from Specinfra::Command::Windows::Base

create

Class Method Details

.check_belongs_to_group(user, group) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/specinfra/command/windows/base/user.rb', line 11

def check_belongs_to_group(user, group)
  user_id, user_domain =  user
  group_id, group_domain =  group
  Backend::PowerShell::Command.new do
    using 'find_user.ps1'
    using 'find_group.ps1'
    using 'find_usergroup.ps1'
    exec "(FindUserGroup -userName '#{user_id}'#{user_domain.nil? ? "" : " -userDomain '#{user_domain}'"} -groupName '#{group_id}'#{group_domain.nil? ? "" : " -groupDomain '#{group_domain}'"}) -ne $null"
  end
end

.check_exists(user) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/specinfra/command/windows/base/user.rb', line 3

def check_exists(user)
  user_id, domain =  user
  Backend::PowerShell::Command.new do
    using 'find_user.ps1'
    exec "(FindUser -userName '#{user_id}'#{domain.nil? ? "" : " -domain '#{domain}'"}) -ne $null"
  end
end