User
|
public sealed class UserInfo : ISupportLifecycle, IDisposable, IPersistSettings
The UserInfo type exposes the following members.
Name | Description | |
---|---|---|
UserInfo(String) | Initializes a new instance of the UserInfo class. | |
UserInfo(String, String) | Initializes a new instance of the UserInfo class. |
Name | Description | |
---|---|---|
AccountCreationDate | Gets the DateTime when the account was created. | |
AccountIsDisabled | Gets flag that determines if account is disabled for this user. | |
AccountIsLockedOut | Gets flag that determines if account is locked-out for this user. | |
City | Gets the City where the user works. | |
Company | Gets the Company of the user. | |
CurrentUserID | Gets the ID name of the current user. | |
CurrentUserInfo | Gets the UserInfo object for the CurrentUserID. | |
Department | Gets the Department where the user works. | |
Description | Gets the description specified for the user. | |
DisplayName | Gets the Display Name the user. | |
Domain | Gets the domain for the user. | |
DomainRespondsForUser | Gets flag that determines if domain is responding to user existence. | |
Gets the E-Mail address of the user. | ||
Exists | Gets flag that determines if user exists. | |
FirstName | Gets the First Name of the user. | |
FullName | Gets the Full Name of the user. | |
Groups | Gets all the groups associated with the user - this includes local groups and Active Directory groups if applicable. | |
IsLocalAccount | Gets flag that determines if this UserInfo instance is based on a local account instead of found through LDAP. | |
LastLogon | Gets the last login time of the user. | |
LastName | Gets the Last Name of the user. | |
LdapID | Gets the ID of the user in LDAP format. | |
LdapPath | Gets LDAP path defined for this user, if any. | |
LocalGroups | Gets the local groups the user is a member of. | |
LoginID | Gets the Login ID of the user. | |
MachineIsJoinedToDomain | Gets a boolean value that indicates whether the current machine is joined to a domain (non-local such as AD or LDAP). | |
Mailbox | Gets the Mailbox address of where the user works. | |
MaximumPasswordAge | Gets this maximum password age for the user. | |
MiddleInitial | Gets the Middle Initial of the user. | |
NextPasswordChangeDate | Gets the DateTime, in UTC, of next password change for the user. | |
Office | Gets the Office location of the user. | |
PassthroughPrincipal | Gets or sets the principal used for passthrough authentication. | |
PasswordCannotChange | Gets flag that determines if account password cannot change for this user. | |
PasswordDoesNotExpire | Gets flag that determines if account password does not expire for this user. | |
PersistSettings | Gets or sets a boolean value that indicates whether the settings of UserInfo object are to be saved to the config file. | |
RemoteUserID | Gets the LoginID of the remote web user. | |
RemoteUserInfo | Gets the UserInfo object for the RemoteUserID. | |
SettingsCategory | Gets or sets the category under which the settings of UserInfo object are to be saved to the config file if the PersistSettings property is set to true. | |
Telephone | Gets the Telephone Number of the user. | |
Title | Gets the Title of the user. | |
UserAccountControl | Gets the account control information of the user. | |
UserName | Gets the user name of the user. | |
Webpage | Gets the web page address of the user. |
Name | Description | |
---|---|---|
AddUserToLocalGroup | Adds an existing user to the specified local groupName. | |
AuthenticateUser(String, String, String) | Authenticates the specified user credentials. | |
AuthenticateUser(String, String, String, String) | Authenticates the specified user credentials. | |
ChangePassword | Attempts to change the user's password. | |
CreateLocalGroup | Creates a new local group if it does not exist already. | |
CreateLocalUser | Creates a new local user if it does not exist already. | |
DefinePrivilegedAccount | Defines the credentials of a privileged domain account that can be used for impersonation prior to the retrieval of user information from the Active Directory. | |
Dispose | Releases all the resources used by the UserInfo object. | |
EndImpersonation | Ends the impersonation of the specified user. | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
Finalize |
Releases the unmanaged resources before the UserInfo object is reclaimed by GC.
(Overrides ObjectFinalize) | |
GetBuiltInLocalGroups | Returns a sorted list of the common built-in local groups. On Windows these groups have a domain name of BUILTIN. | |
GetHashCode | Serves as the default hash function. (Inherited from Object) | |
GetLocalGroupUserList | Gets a list of users that exist in the specified local groupName. | |
GetType | Gets the Type of the current instance. (Inherited from Object) | |
GetUserPropertyValue | Returns the value for specified active directory property. | |
GroupNameToSID | Converts the given group name to the SID corresponding to that name. | |
ImpersonatePrivilegedAccount | Impersonates the defined privileged domain account. | |
ImpersonateUser | Impersonates the specified user. | |
Initialize | Initializes the UserInfo object. | |
IsGroupSID | Determines whether the given security identifier identifies a group. | |
IsLocalDomain | Determines if specified domain is the local domain (i.e., local machine). | |
IsUserSID | Determines whether the given security identifier identifies a user account. | |
LoadSettings | Loads saved settings for the UserInfo object from the config file if the PersistSettings property is set to true. | |
LocalGroupExists | Determines if local group exists. | |
LocalUserExists | Determines if local user exists. | |
RemoveLocalGroup | Removes local group if it exists. | |
RemoveLocalUser | Removes local user if it exists. | |
RemoveUserFromLocalGroup | Removes an existing user from the specified local groupName. | |
SaveSettings | Saves settings for the UserInfo object to the config file if the PersistSettings property is set to true. | |
SetLocalUserPassword | Sets local user's password. | |
SIDToAccountName | Converts the given SID to the corresponding account name. | |
ToString | Returns a string that represents the current object. (Inherited from Object) | |
UserIsInLocalGroup | Determines if user is in the specified local groupName. | |
UserNameToSID | Converts the given user name to the SID corresponding to that name. |
Name | Description | |
---|---|---|
BuiltInGroupName | Localized version of Windows "BUILTIN" local permissions group name. | |
DefaultPersistSettings | Specifies the default value for the PersistSettings property. | |
DefaultSettingsCategory | Specifies the default value for the SettingsCategory property. | |
NTAuthorityGroupName | Localized version of Windows "NT AUTHORITY" local permissions group name. | |
NTServiceGroupName | Localized version of Windows "NT SERVICE" local Windows services group name. |
Name | Description | |
---|---|---|
GetEnumValueOrDefault |
Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) | |
GetEnumValueOrDefaultT |
Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) |
using System; using GSF.Identity; class Program { static void Main(string[] args) { // Retrieve and display user information from Active Directory. using (UserInfo user = new UserInfo("XYZCorp\\johndoe")) { Console.WriteLine(string.Format("First Name: {0}", user.FirstName)); Console.WriteLine(string.Format("Last Name: {0}", user.LastName)); Console.WriteLine(string.Format("Middle Initial: {0}", user.MiddleInitial)); Console.WriteLine(string.Format("Email Address: {0}", user.Email)); Console.WriteLine(string.Format("Telephone Number: {0}", user.Telephone)); } Console.ReadLine(); } }
<?xml version="1.0"?> <configuration> <configSections> <section name="categorizedSettings" type="GSF.Configuration.CategorizedSettingsSection, GSF.Core" /> </configSections> <categorizedSettings> <activeDirectory> <add name="PrivilegedDomain" value="" description="Domain of privileged domain user account." encrypted="false" /> <add name="PrivilegedUserName" value="" description="Username of privileged domain user account." encrypted="false" /> <add name="PrivilegedPassword" value="" description="Password of privileged domain user account." encrypted="true" /> </activeDirectory> </categorizedSettings> </configuration>