C# Class ScrewTurn.Wiki.UsersStorageProvider

Implements a Users Storage Provider.
Inheritance: IUsersStorageProviderV30
Afficher le fichier Open project: mono/ScrewTurnWiki Class Usage Examples

Méthodes publiques

Méthode Description
AddUser ( string username, string displayName, string password, string email, bool active, System.DateTime dateTime ) : UserInfo

Adds a new User.

AddUserGroup ( string name, string description ) : UserGroup

Adds a new user group.

GetUser ( string username ) : UserInfo

Tries to retrieve the information about a user account.

GetUserByEmail ( string email ) : UserInfo

Tries to retrieve the information about a user account.

GetUserGroups ( ) : UserGroup[]

Gets all the user groups.

GetUsers ( ) : UserInfo[]

Gets the complete list of Users.

GetUsersWithData ( string key ) : string>.IDictionary

Gets all the users that have the specified element in their data.

Init ( IHostV30 host, string config ) : void

Initializes the Provider.

ModifyUser ( UserInfo user, string newDisplayName, string newPassword, string newEmail, bool newActive ) : UserInfo

Modifies a User.

ModifyUserGroup ( UserGroup group, string description ) : UserGroup

Modifies a user group.

NotifyCookieLogin ( UserInfo user ) : void

Notifies the provider that a user has logged in through the authentication cookie.

NotifyLogout ( UserInfo user ) : void

Notifies the provider that a user has logged out.

RemoveUser ( UserInfo user ) : bool

Removes a User.

RemoveUserGroup ( UserGroup group ) : bool

Removes a user group.

RetrieveAllUserData ( UserInfo user ) : string>.IDictionary

Retrieves all the user data elements for a user.

RetrieveUserData ( UserInfo user, string key ) : string

Gets a user data element, if any.

SetUserMembership ( UserInfo user, string groups ) : UserInfo

Sets the group memberships of a user account.

Shutdown ( ) : void

Method invoked on shutdown.

This method might not be invoked in some cases.

StoreUserData ( UserInfo user, string key, string value ) : bool

Stores a user data element, overwriting the previous one if present.

TestAccount ( UserInfo user, string password ) : bool

Tests a Password for a User account.

TryAutoLogin ( System context ) : UserInfo

Tries to login a user directly through the provider using the current HttpContext and without username/password.

TryManualLogin ( string username, string password ) : UserInfo

Tries to login a user directly through the provider.

Private Methods

Méthode Description
BackupGroupsFile ( ) : void
BackupUsersFile ( ) : void
DumpUserGroups ( UserGroup groups ) : void

Dumps user groups on disk.

DumpUsers ( UserInfo users ) : void

Writes on disk all the Users.

This method does not lock resources, therefore a lock is need in the caller.

FindGroup ( string name ) : UserGroup

Finds a user group.

GetFullPath ( string filename ) : string
GetGroupsForUser ( string user, UserGroup groups ) : string[]

Gets the names of all the groups a user is member of.

IsSelected ( UserGroup group, string groups ) : bool

Determines whether a user group is contained in an array of user group names.

LoadLocalInstance ( UserInfo user ) : LocalUserInfo

Loads a proper local instance of a user account.

UserExists ( UserInfo user ) : bool

Searches for a User.

VerifyAndPerformUpgrade ( ) : void

Verifies the need for a data upgrade, and performs it when needed.

Method Details

AddUser() public méthode

Adds a new User.
If username, password or email are null. If username, password or email are empty.
public AddUser ( string username, string displayName, string password, string email, bool active, System.DateTime dateTime ) : UserInfo
username string The Username.
displayName string The display name (can be null).
password string The Password.
email string The Email address.
active bool A value specifying whether or not the account is active.
dateTime System.DateTime The Account creation Date/Time.
Résultat UserInfo

AddUserGroup() public méthode

Adds a new user group.
If name or description are null. If name is empty.
public AddUserGroup ( string name, string description ) : UserGroup
name string The name of the group.
description string The description of the group.
Résultat UserGroup

GetUser() public méthode

Tries to retrieve the information about a user account.
If username is null. If username is empty.
public GetUser ( string username ) : UserInfo
username string The username.
Résultat UserInfo

GetUserByEmail() public méthode

Tries to retrieve the information about a user account.
If email is null. If email is empty.
public GetUserByEmail ( string email ) : UserInfo
email string The email address.
Résultat UserInfo

GetUserGroups() public méthode

Gets all the user groups.
public GetUserGroups ( ) : UserGroup[]
Résultat UserGroup[]

GetUsers() public méthode

Gets the complete list of Users.
public GetUsers ( ) : UserInfo[]
Résultat UserInfo[]

GetUsersWithData() public méthode

Gets all the users that have the specified element in their data.
If key is null. If key is empty.
public GetUsersWithData ( string key ) : string>.IDictionary
key string The key of the data.
Résultat string>.IDictionary

Init() public méthode

Initializes the Provider.
If host or config are null. If config is not valid or is incorrect.
public Init ( IHostV30 host, string config ) : void
host IHostV30 The Host of the Provider.
config string The Configuration data, if any.
Résultat void

ModifyUser() public méthode

Modifies a User.
If user or newEmail are null. If newEmail is empty.
public ModifyUser ( UserInfo user, string newDisplayName, string newPassword, string newEmail, bool newActive ) : UserInfo
user UserInfo The Username of the user to modify.
newDisplayName string The new display name (can be null).
newPassword string The new Password (null or blank to keep the current password).
newEmail string The new Email address.
newActive bool A value indicating whether the account is active.
Résultat UserInfo

ModifyUserGroup() public méthode

Modifies a user group.
If group or description are null.
public ModifyUserGroup ( UserGroup group, string description ) : UserGroup
group UserGroup The group to modify.
description string The new description of the group.
Résultat UserGroup

NotifyCookieLogin() public méthode

Notifies the provider that a user has logged in through the authentication cookie.
If user is null.
public NotifyCookieLogin ( UserInfo user ) : void
user UserInfo The user who has logged in.
Résultat void

NotifyLogout() public méthode

Notifies the provider that a user has logged out.
If user is null.
public NotifyLogout ( UserInfo user ) : void
user UserInfo The user who has logged out.
Résultat void

RemoveUser() public méthode

Removes a User.
If user is null.
public RemoveUser ( UserInfo user ) : bool
user UserInfo The User to remove.
Résultat bool

RemoveUserGroup() public méthode

Removes a user group.
If group is null.
public RemoveUserGroup ( UserGroup group ) : bool
group UserGroup The group to remove.
Résultat bool

RetrieveAllUserData() public méthode

Retrieves all the user data elements for a user.
If user is null.
public RetrieveAllUserData ( UserInfo user ) : string>.IDictionary
user UserInfo The user.
Résultat string>.IDictionary

RetrieveUserData() public méthode

Gets a user data element, if any.
If user or key are null. If key is empty.
public RetrieveUserData ( UserInfo user, string key ) : string
user UserInfo The user the data belongs to.
key string The key of the data element.
Résultat string

SetUserMembership() public méthode

Sets the group memberships of a user account.
If user or groups are null.
public SetUserMembership ( UserInfo user, string groups ) : UserInfo
user UserInfo The user account.
groups string The groups the user account is member of.
Résultat UserInfo

Shutdown() public méthode

Method invoked on shutdown.
This method might not be invoked in some cases.
public Shutdown ( ) : void
Résultat void

StoreUserData() public méthode

Stores a user data element, overwriting the previous one if present.
If user or key are null. If key is empty.
public StoreUserData ( UserInfo user, string key, string value ) : bool
user UserInfo The user the data belongs to.
key string The key of the data element (case insensitive).
value string The value of the data element, null for deleting the data.
Résultat bool

TestAccount() public méthode

Tests a Password for a User account.
If user or password are null.
public TestAccount ( UserInfo user, string password ) : bool
user UserInfo The User account.
password string The Password to test.
Résultat bool

TryAutoLogin() public méthode

Tries to login a user directly through the provider using the current HttpContext and without username/password.
If context is null.
public TryAutoLogin ( System context ) : UserInfo
context System The current HttpContext.
Résultat UserInfo

TryManualLogin() public méthode

Tries to login a user directly through the provider.
If username or password are null.
public TryManualLogin ( string username, string password ) : UserInfo
username string The username.
password string The password.
Résultat UserInfo