Sha256: fe9518dd7a1e8e939440ee4089c2065658d1ed2800c8f0d4e88efbd90c64415d

Contents?: true

Size: 834 Bytes

Versions: 5

Compression:

Stored size: 834 Bytes

Contents

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

  def check_is_belonging_to_group(user, group)
    user_id, user_domain = windows_account user
    group_id, group_domain = windows_account 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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
specinfra-2.0.0.beta11 lib/specinfra/command/windows/base/user.rb
specinfra-2.0.0.beta10 lib/specinfra/command/windows/base/user.rb
specinfra-2.0.0.beta9 lib/specinfra/command/windows/base/user.rb
specinfra-2.0.0.beta8 lib/specinfra/command/windows/base/user.rb
specinfra-2.0.0.beta7 lib/specinfra/command/windows/base/user.rb