Sha256: ae73db6dc17b2ea92e1ac5ff54fe244e32f3a232f63ff802ca21dbc08a09add5

Contents?: true

Size: 885 Bytes

Versions: 381

Compression:

Stored size: 885 Bytes

Contents

class Specinfra::Command::Windows::Base::User < Specinfra::Command::Windows::Base
  class << self
    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_belongs_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
end

Version data entries

381 entries across 381 versions & 3 rubygems

Version Path
specinfra-2.91.0 lib/specinfra/command/windows/base/user.rb
specinfra-2.90.1 lib/specinfra/command/windows/base/user.rb
specinfra-2.90.0 lib/specinfra/command/windows/base/user.rb
specinfra-2.89.0 lib/specinfra/command/windows/base/user.rb
specinfra-2.88.2 lib/specinfra/command/windows/base/user.rb
specinfra-2.88.1 lib/specinfra/command/windows/base/user.rb
specinfra-2.88.0 lib/specinfra/command/windows/base/user.rb
specinfra-2.87.2 lib/specinfra/command/windows/base/user.rb
specinfra-2.87.1 lib/specinfra/command/windows/base/user.rb
specinfra-2.87.0 lib/specinfra/command/windows/base/user.rb
specinfra-2.86.0 lib/specinfra/command/windows/base/user.rb
specinfra-2.85.1 lib/specinfra/command/windows/base/user.rb
specinfra-2.85.0 lib/specinfra/command/windows/base/user.rb
specinfra-2.84.1 lib/specinfra/command/windows/base/user.rb
specinfra-2.84.0 lib/specinfra/command/windows/base/user.rb
specinfra-2.83.4 lib/specinfra/command/windows/base/user.rb
specinfra-2.83.3 lib/specinfra/command/windows/base/user.rb
specinfra-2.83.2 lib/specinfra/command/windows/base/user.rb
specinfra-2.83.1 lib/specinfra/command/windows/base/user.rb
specinfra-2.83.0 lib/specinfra/command/windows/base/user.rb