Class: Sys::Admin::User

Inherits:
Object
  • Object
show all
Defined in:
lib/sys/admin/common.rb,
lib/windows/sys/admin.rb

Overview

The User class encapsulates the information typically found within an /etc/passwd entry.

Constant Summary collapse

TEMP_DUPLICATE =

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

0x0100
NORMAL =

Default account type that represents a typical user.

0x0200
INTERDOMAIN_TRUST =

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

0x0800
WORKSTATION_TRUST =

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

0x1000
SERVER_TRUST =

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

0x2000

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ User

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.

Yields:

  • (_self)

Yield Parameters:



95
96
97
# File 'lib/sys/admin/common.rb', line 95

def initialize
  yield self if block_given?
end

Instance Attribute Details

#access_classObject

The user’s access class.



73
74
75
# File 'lib/sys/admin/common.rb', line 73

def access_class
  @access_class
end

#account_typeObject

Returns the account type as a human readable string.



805
806
807
# File 'lib/windows/sys/admin.rb', line 805

def 
  @account_type
end

#ageObject

Used in the past for password aging. Deprecated by /etc/shadow.



79
80
81
# File 'lib/sys/admin/common.rb', line 79

def age
  @age
end

#captionObject

Domain and username of the account.



747
748
749
# File 'lib/windows/sys/admin.rb', line 747

def caption
  @caption
end

#changeObject

Next date a password change will be needed.



52
53
54
# File 'lib/sys/admin/common.rb', line 52

def change
  @change
end

#commentObject

Another comment field.



76
77
78
# File 'lib/sys/admin/common.rb', line 76

def comment
  @comment
end

#descriptionObject

Description of the account.



750
751
752
# File 'lib/windows/sys/admin.rb', line 750

def description
  @description
end

#dirObject

The user’s home directory



61
62
63
# File 'lib/sys/admin/common.rb', line 61

def dir
  @dir
end

#disabled=(value) ⇒ Object (writeonly)

Used to set whether or not the account is disabled.



787
788
789
# File 'lib/windows/sys/admin.rb', line 787

def disabled=(value)
  @disabled = value
end

#domainObject

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



753
754
755
# File 'lib/windows/sys/admin.rb', line 753

def domain
  @domain
end

#expireObject

The account’s expiration date



67
68
69
# File 'lib/sys/admin/common.rb', line 67

def expire
  @expire
end

#fieldsObject

TODO: Forgot what this is.



70
71
72
# File 'lib/sys/admin/common.rb', line 70

def fields
  @fields
end

#full_nameObject

Full name of a local user.



759
760
761
# File 'lib/windows/sys/admin.rb', line 759

def full_name
  @full_name
end

#gecosObject

A comment field. Rarely used now.



55
56
57
# File 'lib/sys/admin/common.rb', line 55

def gecos
  @gecos
end

#gidObject

The user’s primary group ID.



49
50
51
# File 'lib/sys/admin/common.rb', line 49

def gid
  @gid
end

#groupsObject

An array of groups to which the user belongs.



100
101
102
103
104
105
106
107
108
# File 'lib/sys/admin/common.rb', line 100

def groups
  array = []

  Sys::Admin.groups.each do |grp|
    array << grp.name if grp.members.include?(name)
  end

  array
end

#install_dateObject

Date the user account was created.



765
766
767
# File 'lib/windows/sys/admin.rb', line 765

def install_date
  @install_date
end

#local=(value) ⇒ Object (writeonly)

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



790
791
792
# File 'lib/windows/sys/admin.rb', line 790

def local=(value)
  @local = value
end

#lockout=(value) ⇒ Object (writeonly)

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



793
794
795
# File 'lib/windows/sys/admin.rb', line 793

def lockout=(value)
  @lockout = value
end

#login_deviceObject

The name of the terminal device the user last logged on with.



88
89
90
# File 'lib/sys/admin/common.rb', line 88

def 
  @login_device
end

#login_hostObject

The host name from which the user last logged in.



85
86
87
# File 'lib/sys/admin/common.rb', line 85

def 
  @login_host
end

#login_timeObject

The last time the user logged in.



82
83
84
# File 'lib/sys/admin/common.rb', line 82

def 
  @login_time
end

#nameObject

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



40
41
42
# File 'lib/sys/admin/common.rb', line 40

def name
  @name
end

#passwdObject

The user’s encrypted password. Deprecated by /etc/shadow.



43
44
45
# File 'lib/sys/admin/common.rb', line 43

def passwd
  @passwd
end

#passwordObject

The user’s password.



756
757
758
# File 'lib/windows/sys/admin.rb', line 756

def password
  @password
end

#password_changeable=(value) ⇒ Object (writeonly)

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



796
797
798
# File 'lib/windows/sys/admin.rb', line 796

def password_changeable=(value)
  @password_changeable = value
end

#password_expires=(value) ⇒ Object (writeonly)

Sets whether or not the password for the account expires.



799
800
801
# File 'lib/windows/sys/admin.rb', line 799

def password_expires=(value)
  @password_expires = value
end

#password_required=(value) ⇒ Object (writeonly)

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



802
803
804
# File 'lib/windows/sys/admin.rb', line 802

def password_required=(value)
  @password_required = value
end

#quotaObject

The user’s alloted amount of disk space.



58
59
60
# File 'lib/sys/admin/common.rb', line 58

def quota
  @quota
end

#shellObject

The user’s login shell.



64
65
66
# File 'lib/sys/admin/common.rb', line 64

def shell
  @shell
end

#sidObject

The user’s security identifier.



772
773
774
# File 'lib/windows/sys/admin.rb', line 772

def sid
  @sid
end

#sid_typeObject

Returns the SID type as a human readable string.



843
844
845
# File 'lib/windows/sys/admin.rb', line 843

def sid_type
  @sid_type
end

#statusObject

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



775
776
777
# File 'lib/windows/sys/admin.rb', line 775

def status
  @status
end

#uidObject

The user’s id (RID).



46
47
48
# File 'lib/sys/admin/common.rb', line 46

def uid
  @uid
end

Instance Method Details

#disabled?Boolean

Returns whether or not the account is disabled.

Returns:

  • (Boolean)


885
886
887
# File 'lib/windows/sys/admin.rb', line 885

def disabled?
  @disabled
end

#local?Boolean

Returns whether or not the account is local.

Returns:

  • (Boolean)


891
892
893
# File 'lib/windows/sys/admin.rb', line 891

def local?
  @local
end

#lockout?Boolean

Returns whether or not the account is locked out.

Returns:

  • (Boolean)


897
898
899
# File 'lib/windows/sys/admin.rb', line 897

def lockout?
  @lockout
end

#password_changeable?Boolean

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

Returns:

  • (Boolean)


903
904
905
# File 'lib/windows/sys/admin.rb', line 903

def password_changeable?
  @password_changeable
end

#password_expires?Boolean

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

Returns:

  • (Boolean)


909
910
911
# File 'lib/windows/sys/admin.rb', line 909

def password_expires?
  @password_expires
end

#password_required?Boolean

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

Returns:

  • (Boolean)


915
916
917
# File 'lib/windows/sys/admin.rb', line 915

def password_required?
  @password_required
end