Parent

Sys::User

Constants

INTERDOMAIN_TRUST

A permit to trust account for a domain that trusts other domains.

NORMAL

Default account type that represents a typical user.

SERVER_TRUST

A computer account for a backup domain controller that is a member of this domain.

TEMP_DUPLICATE

An account for users whose primary account is in another domain.

WORKSTATION_TRUST

An account for a Windows NT/2000 workstation or server that is a member of this domain.

Attributes

account_type[R]

Returns the account type as a human readable string.

caption[RW]

Domain and username of the account.

description[RW]

Description of the account.

dir[RW]

The user’s home directory

disabled[W]

Used to set whether or not the account is disabled.

domain[RW]

Name of the Windows domain to which a user account belongs.

full_name[RW]

Full name of a local user.

gid[RW]

The user’s primary group ID.

groups[RW]

An array of groups to which the user belongs.

install_date[RW]

Date the user account was created.

local[W]

Sets whether or not the account is defined on the local computer.

lockout[W]

Sets whether or not the account is locked out of the OS.

name[RW]

Name of the Windows user account on the domain that the User#domain property specifies.

password[RW]

The user’s password.

password_changeable[W]

Sets whether or not the password for the account can be changed.

password_expires[W]

Sets whether or not the password for the account expires.

password_required[W]

Sets whether or not a password is required for the account.

sid[RW]

The user’s security identifier.

status[RW]

Current status for the user, such as “ok”, “error”, etc.

uid[RW]

The user’s id (RID).

Public Class Methods

new() click to toggle source

Creates an returns a new User object. A User object encapsulates a user account on the operating system.

Yields self if a block is provided.

# File lib/windows/sys/admin.rb, line 189
def initialize
  yield self if block_given?
end

Public Instance Methods

account_type=(type) click to toggle source

Sets the account type for the account. Possible values are:

  • User::TEMP_DUPLICATE

  • User::NORMAL

  • User::INTERDOMAIN_TRUST

  • User::WORKSTATION_TRUST

  • User::SERVER_TRUST

# File lib/windows/sys/admin.rb, line 201
def account_type=(type)
  case type
    when TEMP_DUPLICATE
      @account_type = 'duplicate'
    when NORMAL
      @account_type = 'normal'
    when INTERDOMAIN_TRUST
      @account_type = 'interdomain_trust'
    when WORKSTATION_TRUST
      @account_type = 'workstation_trust'
    when SERVER_TRUST
      @account_type = 'server_trust'
    else
      @account_type = 'unknown'
  end
end
disabled?() click to toggle source

Returns whether or not the account is disabled.

# File lib/windows/sys/admin.rb, line 264
def disabled?
  @disabled
end
local?() click to toggle source

Returns whether or not the account is local.

# File lib/windows/sys/admin.rb, line 270
def local?
  @local
end
lockout?() click to toggle source

Returns whether or not the account is locked out.

# File lib/windows/sys/admin.rb, line 276
def lockout?
  @lockout
end
password_changeable?() click to toggle source

Returns whether or not the password for the account is changeable.

# File lib/windows/sys/admin.rb, line 282
def password_changeable?
  @password_changeable
end
password_expires?() click to toggle source

Returns whether or not the password for the account is changeable.

# File lib/windows/sys/admin.rb, line 288
def password_expires?
  @password_expires
end
password_required?() click to toggle source

Returns whether or not the a password is required for the account.

# File lib/windows/sys/admin.rb, line 294
def password_required?
  @password_required
end
sid_type() click to toggle source

Returns the SID type as a human readable string.

# File lib/windows/sys/admin.rb, line 220
def sid_type
  @sid_type
end
sid_type=(stype) click to toggle source

Sets the SID (Security Identifier) type to stype, which can be one of the following constant values:

  • Admin::SidTypeUser

  • Admin::SidTypeGroup

  • Admin::SidTypeDomain

  • Admin::SidTypeAlias

  • Admin::SidTypeWellKnownGroup

  • Admin::SidTypeDeletedAccount

  • Admin::SidTypeInvalid

  • Admin::SidTypeUnknown

  • Admin::SidTypeComputer

# File lib/windows/sys/admin.rb, line 237
def sid_type=(stype)
  case stype
    when Admin::SidTypeUser
      @sid_type = 'user'
    when Admin::SidTypeGroup
      @sid_type = 'group'
    when Admin::SidTypeDomain
      @sid_type = 'domain'
    when Admin::SidTypeAlias
      @sid_type = 'alias'
    when Admin::SidTypeWellKnownGroup
      @sid_type = 'well_known_group'
    when Admin::SidTypeDeletedAccount
      @sid_type = 'deleted_account'
    when Admin::SidTypeInvalid
      @sid_type = 'invalid'
    when Admin::SidTypeUnknown
      @sid_type = 'unknown'
    when Admin::SidTypeComputer
      @sid_type = 'computer'
    else
      @sid_type = 'unknown'
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.