using System; using System.Collections.Generic; using System.Text; using System.Globalization; namespace ScrewTurn.Wiki.PluginFramework { /// /// Describes a User. /// public class UserInfo { /// /// The Username of the User. /// protected string username; /// /// The display name of the User. /// protected string displayName; /// /// The Email address of the User. /// protected string email; /// /// A value indicating whether the user account is active. /// protected bool active; /// /// The account creation date/time. /// protected DateTime dateTime; /// /// The names of the groups the user is member of. /// protected string[] groups; /// /// The Provider that handles the User. /// protected IUsersStorageProviderV30 provider; /// /// Initializes a new instance of the UserInfo class. /// /// The Username. /// The display name. /// The Email. /// Specifies whether the Account is active or not. /// The creation DateTime. /// The Users Storage Provider that manages the User. public UserInfo(string username, string displayName, string email, bool active, DateTime dateTime, IUsersStorageProviderV30 provider) { this.username = username; this.displayName = displayName; this.email = email; this.active = active; this.dateTime = dateTime; this.provider = provider; } /// /// Gets the Username. /// public string Username { get { return username; } } /// /// Gets or sets the display name. /// public string DisplayName { get { return displayName; } set { displayName = value; } } /// /// Gets or sets the Email. /// public string Email { get { return email; } set { email = value; } } /// /// Gets or sets a value specifying whether the Account is active or not. /// public bool Active { get { return active; } set { active = value; } } /// /// Gets the creation DateTime. /// public DateTime DateTime { get { return dateTime; } set { dateTime = value; } } /// /// Gets or sets the names of the groups the user is member of. /// public string[] Groups { get { return groups; } set { groups = value; } } /// /// Gets or sets the Users Storage Provider. /// public IUsersStorageProviderV30 Provider { get { return provider; } set { provider = value; } } /// /// Converts the current instance to a string. /// /// The string. public override string ToString() { return username; } } /// /// Provides a method for comparing two UserInfo objects, comparing their Username. /// /// The comparison is case unsensitive. public class UsernameComparer : IComparer { /// /// Compares two UserInfo objects, comparing their Username. /// /// The first object. /// The second object. /// The comparison result (-1, 0 or 1). public int Compare(UserInfo x, UserInfo y) { return StringComparer.OrdinalIgnoreCase.Compare(x.Username, y.Username); } } }