using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
namespace ScrewTurn.Wiki.PluginFramework {
///
/// It is the interface that must be implemented in order to create a custom Users Storage Provider for ScrewTurn Wiki.
///
/// A class that implements this class should not have any kind of data caching.
public interface IUsersStorageProviderV30 : IProviderV30 {
///
/// Tests a Password for a User account.
///
/// The User account.
/// The Password to test.
/// True if the Password is correct.
/// If or are null.
bool TestAccount(UserInfo user, string password);
///
/// Gets the complete list of Users.
///
/// All the Users, sorted by username.
UserInfo[] GetUsers();
///
/// Adds a new User.
///
/// The Username.
/// The display name (can be null).
/// The Password.
/// The Email address.
/// A value indicating whether the account is active.
/// The Account creation Date/Time.
/// The correct object or null.
/// If , or are null.
/// If , or are empty.
UserInfo AddUser(string username, string displayName, string password, string email, bool active, DateTime dateTime);
///
/// Modifies a User.
///
/// The Username of the user to modify.
/// The new display name (can be null).
/// The new Password (null or blank to keep the current password).
/// The new Email address.
/// A value indicating whether the account is active.
/// The correct object or null.
/// If or are null.
/// If is empty.
UserInfo ModifyUser(UserInfo user, string newDisplayName, string newPassword, string newEmail, bool newActive);
///
/// Removes a User.
///
/// The User to remove.
/// True if the User has been removed successfully.
/// If is null.
bool RemoveUser(UserInfo user);
///
/// Gets all the user groups.
///
/// All the groups, sorted by name.
UserGroup[] GetUserGroups();
///
/// Adds a new user group.
///
/// The name of the group.
/// The description of the group.
/// The correct object or null.
/// If or are null.
/// If is empty.
UserGroup AddUserGroup(string name, string description);
///
/// Modifies a user group.
///
/// The group to modify.
/// The new description of the group.
/// The correct object or null.
/// If or are null.
UserGroup ModifyUserGroup(UserGroup group, string description);
///
/// Removes a user group.
///
/// The group to remove.
/// true if the group is removed, false otherwise.
/// If is null.
bool RemoveUserGroup(UserGroup group);
///
/// Sets the group memberships of a user account.
///
/// The user account.
/// The groups the user account is member of.
/// The correct object or null.
/// If or are null.
UserInfo SetUserMembership(UserInfo user, string[] groups);
///
/// Tries to login a user directly through the provider.
///
/// The username.
/// The password.
/// The correct UserInfo object, or null.
/// If or are null.
UserInfo TryManualLogin(string username, string password);
///
/// Tries to login a user directly through the provider using
/// the current HttpContext and without username/password.
///
/// The current HttpContext.
/// The correct UserInfo object, or null.
/// If is null.
UserInfo TryAutoLogin(HttpContext context);
///
/// Gets a user account.
///
/// The username.
/// The , or null.
/// If is null.
/// If is empty.
UserInfo GetUser(string username);
///
/// Gets a user account.
///
/// The email address.
/// The first user found with the specified email address, or null.
/// If is null.
/// If is empty.
UserInfo GetUserByEmail(string email);
///
/// Notifies the provider that a user has logged in through the authentication cookie.
///
/// The user who has logged in.
/// If is null.
void NotifyCookieLogin(UserInfo user);
///
/// Notifies the provider that a user has logged out.
///
/// The user who has logged out.
/// If is null.
void NotifyLogout(UserInfo user);
///
/// Stores a user data element, overwriting the previous one if present.
///
/// The user the data belongs to.
/// The key of the data element (case insensitive).
/// The value of the data element, null for deleting the data.
/// true if the data element is stored, false otherwise.
/// If or are null.
/// If is empty.
bool StoreUserData(UserInfo user, string key, string value);
///
/// Gets a user data element, if any.
///
/// The user the data belongs to.
/// The key of the data element.
/// The value of the data element, or null if the element is not found.
/// If or are null.
/// If is empty.
string RetrieveUserData(UserInfo user, string key);
///
/// Retrieves all the user data elements for a user.
///
/// The user.
/// The user data elements (key->value).
/// If is null.
IDictionary RetrieveAllUserData(UserInfo user);
///
/// Gets all the users that have the specified element in their data.
///
/// The key of the data.
/// The users and the data.
/// If is null.
/// If is empty.
IDictionary GetUsersWithData(string key);
///
/// Gets a value indicating whether user accounts are read-only.
///
bool UserAccountsReadOnly { get; }
///
/// Gets a value indicating whether user groups are read-only. If so, the provider
/// should support default user groups as defined in the wiki configuration.
///
bool UserGroupsReadOnly { get; }
///
/// Gets a value indicating whether group membership is read-only (if
/// is false, then this property must be false). If this property is true, the provider
/// should return membership data compatible with default user groups.
///
bool GroupMembershipReadOnly { get; }
///
/// Gets a value indicating whether users' data is read-only.
///
bool UsersDataReadOnly { get; }
}
}