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.
189 190 191 |
# File 'lib/windows/sys/admin.rb', line 189 def initialize yield self if block_given? end |
Instance Attribute Details
#account_type ⇒ Object
Returns the account type as a human readable string.
182 183 184 |
# File 'lib/windows/sys/admin.rb', line 182 def account_type @account_type end |
#caption ⇒ Object
Domain and username of the account.
124 125 126 |
# File 'lib/windows/sys/admin.rb', line 124 def @caption end |
#description ⇒ Object
Description of the account.
127 128 129 |
# File 'lib/windows/sys/admin.rb', line 127 def description @description end |
#dir ⇒ Object
The user’s home directory
161 162 163 |
# File 'lib/windows/sys/admin.rb', line 161 def dir @dir end |
#disabled=(value) ⇒ Object (writeonly)
Used to set whether or not the account is disabled.
164 165 166 |
# File 'lib/windows/sys/admin.rb', line 164 def disabled=(value) @disabled = value end |
#domain ⇒ Object
Name of the Windows domain to which a user account belongs.
130 131 132 |
# File 'lib/windows/sys/admin.rb', line 130 def domain @domain end |
#full_name ⇒ Object
Full name of a local user.
136 137 138 |
# File 'lib/windows/sys/admin.rb', line 136 def full_name @full_name end |
#gid ⇒ Object
The user’s primary group ID.
158 159 160 |
# File 'lib/windows/sys/admin.rb', line 158 def gid @gid end |
#groups ⇒ Object
An array of groups to which the user belongs.
139 140 141 |
# File 'lib/windows/sys/admin.rb', line 139 def groups @groups end |
#install_date ⇒ Object
Date the user account was created.
142 143 144 |
# File 'lib/windows/sys/admin.rb', line 142 def install_date @install_date end |
#local=(value) ⇒ Object (writeonly)
Sets whether or not the account is defined on the local computer.
167 168 169 |
# File 'lib/windows/sys/admin.rb', line 167 def local=(value) @local = value end |
#lockout=(value) ⇒ Object (writeonly)
Sets whether or not the account is locked out of the OS.
170 171 172 |
# File 'lib/windows/sys/admin.rb', line 170 def lockout=(value) @lockout = value end |
#name ⇒ Object
Name of the Windows user account on the domain that the User#domain property specifies.
146 147 148 |
# File 'lib/windows/sys/admin.rb', line 146 def name @name end |
#password ⇒ Object
The user’s password.
133 134 135 |
# File 'lib/windows/sys/admin.rb', line 133 def password @password end |
#password_changeable=(value) ⇒ Object (writeonly)
Sets whether or not the password for the account can be changed.
173 174 175 |
# File 'lib/windows/sys/admin.rb', line 173 def password_changeable=(value) @password_changeable = value end |
#password_expires=(value) ⇒ Object (writeonly)
Sets whether or not the password for the account expires.
176 177 178 |
# File 'lib/windows/sys/admin.rb', line 176 def password_expires=(value) @password_expires = value end |
#password_required=(value) ⇒ Object (writeonly)
Sets whether or not a password is required for the account.
179 180 181 |
# File 'lib/windows/sys/admin.rb', line 179 def password_required=(value) @password_required = value end |
#sid ⇒ Object
The user’s security identifier.
149 150 151 |
# File 'lib/windows/sys/admin.rb', line 149 def sid @sid end |
#status ⇒ Object
Current status for the user, such as “ok”, “error”, etc.
152 153 154 |
# File 'lib/windows/sys/admin.rb', line 152 def status @status end |
#uid ⇒ Object
The user’s id (RID).
155 156 157 |
# File 'lib/windows/sys/admin.rb', line 155 def uid @uid end |
Instance Method Details
#disabled? ⇒ Boolean
Returns whether or not the account is disabled.
264 265 266 |
# File 'lib/windows/sys/admin.rb', line 264 def disabled? @disabled end |
#local? ⇒ Boolean
Returns whether or not the account is local.
270 271 272 |
# File 'lib/windows/sys/admin.rb', line 270 def local? @local end |
#lockout? ⇒ Boolean
Returns whether or not the account is locked out.
276 277 278 |
# File 'lib/windows/sys/admin.rb', line 276 def lockout? @lockout end |
#password_changeable? ⇒ Boolean
Returns whether or not the password for the account is changeable.
282 283 284 |
# File 'lib/windows/sys/admin.rb', line 282 def password_changeable? @password_changeable end |
#password_expires? ⇒ Boolean
Returns whether or not the password for the account is changeable.
288 289 290 |
# File 'lib/windows/sys/admin.rb', line 288 def password_expires? @password_expires end |
#password_required? ⇒ Boolean
Returns whether or not the a password is required for the account.
294 295 296 |
# File 'lib/windows/sys/admin.rb', line 294 def password_required? @password_required end |
#sid_type ⇒ Object
Returns the SID type as a human readable string.
220 221 222 |
# File 'lib/windows/sys/admin.rb', line 220 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
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# 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 |