Class: Sys::User
- Inherits:
-
Object
- Object
- Sys::User
- Defined in:
- lib/windows/sys/admin.rb
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
-
#account_type ⇒ Object
Returns the account type as a human readable string.
-
#caption ⇒ Object
Domain and username of the account.
-
#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.
-
#full_name ⇒ Object
Full name of a local user.
-
#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.
-
#name ⇒ Object
Name of the Windows user account on the domain that the User#domain property specifies.
-
#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.
-
#sid ⇒ Object
The user’s security identifier.
-
#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.
-
#sid_type ⇒ Object
Returns the SID type as a human readable string.
-
#sid_type=(stype) ⇒ Object
Sets the SID (Security Identifier) type to
stype, which can be one of the following constant values:.
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.
187 188 189 |
# File 'lib/windows/sys/admin.rb', line 187 def initialize yield self if block_given? end |
Instance Attribute Details
#account_type ⇒ Object
Returns the account type as a human readable string.
180 181 182 |
# File 'lib/windows/sys/admin.rb', line 180 def account_type @account_type end |
#caption ⇒ Object
Domain and username of the account.
122 123 124 |
# File 'lib/windows/sys/admin.rb', line 122 def caption @caption end |
#description ⇒ Object
Description of the account.
125 126 127 |
# File 'lib/windows/sys/admin.rb', line 125 def description @description end |
#dir ⇒ Object
The user’s home directory
159 160 161 |
# File 'lib/windows/sys/admin.rb', line 159 def dir @dir end |
#disabled=(value) ⇒ Object (writeonly)
Used to set whether or not the account is disabled.
162 163 164 |
# File 'lib/windows/sys/admin.rb', line 162 def disabled=(value) @disabled = value end |
#domain ⇒ Object
Name of the Windows domain to which a user account belongs.
128 129 130 |
# File 'lib/windows/sys/admin.rb', line 128 def domain @domain end |
#full_name ⇒ Object
Full name of a local user.
134 135 136 |
# File 'lib/windows/sys/admin.rb', line 134 def full_name @full_name end |
#gid ⇒ Object
The user’s primary group ID.
156 157 158 |
# File 'lib/windows/sys/admin.rb', line 156 def gid @gid end |
#groups ⇒ Object
An array of groups to which the user belongs.
137 138 139 |
# File 'lib/windows/sys/admin.rb', line 137 def groups @groups end |
#install_date ⇒ Object
Date the user account was created.
140 141 142 |
# File 'lib/windows/sys/admin.rb', line 140 def install_date @install_date end |
#local=(value) ⇒ Object (writeonly)
Sets whether or not the account is defined on the local computer.
165 166 167 |
# File 'lib/windows/sys/admin.rb', line 165 def local=(value) @local = value end |
#lockout=(value) ⇒ Object (writeonly)
Sets whether or not the account is locked out of the OS.
168 169 170 |
# File 'lib/windows/sys/admin.rb', line 168 def lockout=(value) @lockout = value end |
#name ⇒ Object
Name of the Windows user account on the domain that the User#domain property specifies.
144 145 146 |
# File 'lib/windows/sys/admin.rb', line 144 def name @name end |
#password ⇒ Object
The user’s password.
131 132 133 |
# File 'lib/windows/sys/admin.rb', line 131 def password @password end |
#password_changeable=(value) ⇒ Object (writeonly)
Sets whether or not the password for the account can be changed.
171 172 173 |
# File 'lib/windows/sys/admin.rb', line 171 def password_changeable=(value) @password_changeable = value end |
#password_expires=(value) ⇒ Object (writeonly)
Sets whether or not the password for the account expires.
174 175 176 |
# File 'lib/windows/sys/admin.rb', line 174 def password_expires=(value) @password_expires = value end |
#password_required=(value) ⇒ Object (writeonly)
Sets whether or not a password is required for the account.
177 178 179 |
# File 'lib/windows/sys/admin.rb', line 177 def password_required=(value) @password_required = value end |
#sid ⇒ Object
The user’s security identifier.
147 148 149 |
# File 'lib/windows/sys/admin.rb', line 147 def sid @sid end |
#status ⇒ Object
Current status for the user, such as “ok”, “error”, etc.
150 151 152 |
# File 'lib/windows/sys/admin.rb', line 150 def status @status end |
#uid ⇒ Object
The user’s id (RID).
153 154 155 |
# File 'lib/windows/sys/admin.rb', line 153 def uid @uid end |
Instance Method Details
#disabled? ⇒ Boolean
Returns whether or not the account is disabled.
262 263 264 |
# File 'lib/windows/sys/admin.rb', line 262 def disabled? @disabled end |
#local? ⇒ Boolean
Returns whether or not the account is local.
268 269 270 |
# File 'lib/windows/sys/admin.rb', line 268 def local? @local end |
#lockout? ⇒ Boolean
Returns whether or not the account is locked out.
274 275 276 |
# File 'lib/windows/sys/admin.rb', line 274 def lockout? @lockout end |
#password_changeable? ⇒ Boolean
Returns whether or not the password for the account is changeable.
280 281 282 |
# File 'lib/windows/sys/admin.rb', line 280 def password_changeable? @password_changeable end |
#password_expires? ⇒ Boolean
Returns whether or not the password for the account is changeable.
286 287 288 |
# File 'lib/windows/sys/admin.rb', line 286 def password_expires? @password_expires end |
#password_required? ⇒ Boolean
Returns whether or not the a password is required for the account.
292 293 294 |
# File 'lib/windows/sys/admin.rb', line 292 def password_required? @password_required end |
#sid_type ⇒ Object
Returns the SID type as a human readable string.
218 219 220 |
# File 'lib/windows/sys/admin.rb', line 218 def sid_type @sid_type end |
#sid_type=(stype) ⇒ Object
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
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/windows/sys/admin.rb', line 235 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 |