Class: Sys::Admin::User
- Inherits:
-
Object
- Object
- Sys::Admin::User
- 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
-
#access_class ⇒ Object
The user’s access class.
-
#account_type ⇒ Object
Returns the account type as a human readable string.
-
#age ⇒ Object
Used in the past for password aging.
-
#caption ⇒ Object
Domain and username of the account.
-
#change ⇒ Object
Next date a password change will be needed.
-
#comment ⇒ Object
Another comment field.
-
#description ⇒ Object
Description of the account.
-
#dir ⇒ Object
The user’s home directory.
-
#disabled ⇒ Object
writeonly
Used to set whether or not the account is disabled.
-
#domain ⇒ Object
Name of the Windows domain to which a user account belongs.
-
#expire ⇒ Object
The account’s expiration date.
-
#fields ⇒ Object
TODO: Forgot what this is.
-
#full_name ⇒ Object
Full name of a local user.
-
#gecos ⇒ Object
A comment field.
-
#gid ⇒ Object
The user’s primary group ID.
-
#groups ⇒ Object
An array of groups to which the user belongs.
-
#install_date ⇒ Object
Date the user account was created.
-
#local ⇒ Object
writeonly
Sets whether or not the account is defined on the local computer.
-
#lockout ⇒ Object
writeonly
Sets whether or not the account is locked out of the OS.
-
#login_device ⇒ Object
The name of the terminal device the user last logged on with.
-
#login_host ⇒ Object
The host name from which the user last logged in.
-
#login_time ⇒ Object
The last time the user logged in.
-
#name ⇒ Object
Name of the Windows user account on the domain that the User#domain property specifies.
-
#passwd ⇒ Object
The user’s encrypted password.
-
#password ⇒ Object
The user’s password.
-
#password_changeable ⇒ Object
writeonly
Sets whether or not the password for the account can be changed.
-
#password_expires ⇒ Object
writeonly
Sets whether or not the password for the account expires.
-
#password_required ⇒ Object
writeonly
Sets whether or not a password is required for the account.
-
#quota ⇒ Object
The user’s alloted amount of disk space.
-
#shell ⇒ Object
The user’s login shell.
-
#sid ⇒ Object
The user’s security identifier.
-
#sid_type ⇒ Object
Returns the SID type as a human readable string.
-
#status ⇒ Object
Current status for the user, such as “ok”, “error”, etc.
-
#uid ⇒ Object
The user’s id (RID).
Instance Method Summary collapse
-
#disabled? ⇒ Boolean
Returns whether or not the account is disabled.
-
#initialize {|_self| ... } ⇒ User
constructor
Creates an returns a new User object.
-
#local? ⇒ Boolean
Returns whether or not the account is local.
-
#lockout? ⇒ Boolean
Returns whether or not the account is locked out.
-
#password_changeable? ⇒ Boolean
Returns whether or not the password for the account is changeable.
-
#password_expires? ⇒ Boolean
Returns whether or not the password for the account is changeable.
-
#password_required? ⇒ Boolean
Returns whether or not the a password is required for the account.
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.
95 96 97 |
# File 'lib/sys/admin/common.rb', line 95 def initialize yield self if block_given? end |
Instance Attribute Details
#access_class ⇒ Object
The user’s access class.
73 74 75 |
# File 'lib/sys/admin/common.rb', line 73 def access_class @access_class end |
#account_type ⇒ Object
Returns the account type as a human readable string.
805 806 807 |
# File 'lib/windows/sys/admin.rb', line 805 def account_type @account_type end |
#age ⇒ Object
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 |
#caption ⇒ Object
Domain and username of the account.
747 748 749 |
# File 'lib/windows/sys/admin.rb', line 747 def caption @caption end |
#change ⇒ Object
Next date a password change will be needed.
52 53 54 |
# File 'lib/sys/admin/common.rb', line 52 def change @change end |
#comment ⇒ Object
Another comment field.
76 77 78 |
# File 'lib/sys/admin/common.rb', line 76 def comment @comment end |
#description ⇒ Object
Description of the account.
750 751 752 |
# File 'lib/windows/sys/admin.rb', line 750 def description @description end |
#dir ⇒ Object
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 |
#domain ⇒ Object
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 |
#expire ⇒ Object
The account’s expiration date
67 68 69 |
# File 'lib/sys/admin/common.rb', line 67 def expire @expire end |
#fields ⇒ Object
TODO: Forgot what this is.
70 71 72 |
# File 'lib/sys/admin/common.rb', line 70 def fields @fields end |
#full_name ⇒ Object
Full name of a local user.
759 760 761 |
# File 'lib/windows/sys/admin.rb', line 759 def full_name @full_name end |
#gecos ⇒ Object
A comment field. Rarely used now.
55 56 57 |
# File 'lib/sys/admin/common.rb', line 55 def gecos @gecos end |
#gid ⇒ Object
The user’s primary group ID.
49 50 51 |
# File 'lib/sys/admin/common.rb', line 49 def gid @gid end |
#groups ⇒ Object
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_date ⇒ Object
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_device ⇒ Object
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 @login_device end |
#login_host ⇒ Object
The host name from which the user last logged in.
85 86 87 |
# File 'lib/sys/admin/common.rb', line 85 def login_host @login_host end |
#login_time ⇒ Object
The last time the user logged in.
82 83 84 |
# File 'lib/sys/admin/common.rb', line 82 def login_time @login_time end |
#name ⇒ Object
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 |
#passwd ⇒ Object
The user’s encrypted password. Deprecated by /etc/shadow.
43 44 45 |
# File 'lib/sys/admin/common.rb', line 43 def passwd @passwd end |
#password ⇒ Object
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 |
#quota ⇒ Object
The user’s alloted amount of disk space.
58 59 60 |
# File 'lib/sys/admin/common.rb', line 58 def quota @quota end |
#shell ⇒ Object
The user’s login shell.
64 65 66 |
# File 'lib/sys/admin/common.rb', line 64 def shell @shell end |
#sid ⇒ Object
The user’s security identifier.
772 773 774 |
# File 'lib/windows/sys/admin.rb', line 772 def sid @sid end |
#sid_type ⇒ Object
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 |
#status ⇒ Object
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 |
#uid ⇒ Object
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.
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.
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.
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.
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.
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.
915 916 917 |
# File 'lib/windows/sys/admin.rb', line 915 def password_required? @password_required end |