C# Class Phun.Security.PhunSimpleRoleProvider

Copied from: https://github.com/ASP-NET-MVC/aspnetwebstack/blob/master/src/WebMatrix.WebData/SimpleRoleProvider.cs Apache License copyright 2.0 blah blah... to support more database engines.
Inheritance: System.Web.Security.RoleProvider
Afficher le fichier Open project: noogen/phuncms Class Usage Examples

Private Properties

Свойство Type Description
ConnectToDatabase DapperContext
CreateTablesIfNeeded void
FindRoleId int
GetRoleIdsFromNames List
GetUserIdsFromNames List
VerifyInitialized void

Méthodes publiques

Méthode Description
AddCache ( string userName, string roles ) : void

Adds the cache.

AddUsersToRoles ( string usernames, string roleNames ) : void

Adds the specified user names to the specified roles for the configured applicationName.

CreateRole ( string roleName ) : void

Adds a new role to the data source for the configured applicationName.

DeleteRole ( string roleName, bool throwOnPopulatedRole ) : bool

Removes a role from the data source for the configured applicationName.

FindUsersInRole ( string roleName, string usernameToMatch ) : string[]

Gets an array of user names in a role where the user name contains the specified user name to match.

GetAllRoles ( ) : string[]

Gets a list of all the roles for the configured applicationName.

GetRolesForUser ( string username ) : string[]

Gets a list of the roles that a specified user is in for the configured applicationName.

GetUsersInRole ( string roleName ) : string[]

Gets a list of users in the specified role for the configured applicationName.

IsUserInRole ( string username, string roleName ) : bool

Gets a value indicating whether the specified user is in the specified role for the configured applicationName.

PhunSimpleRoleProvider ( ) : System

Initializes a new instance of the SimpleRoleProvider class.

PhunSimpleRoleProvider ( System.Web.Security.RoleProvider previousProvider ) : System

Initializes a new instance of the SimpleRoleProvider class.

RemoveCache ( string userName ) : void

Clears the cache.

RemoveUsersFromRoles ( string usernames, string roleNames ) : void

Removes the specified user names from the specified roles for the configured applicationName.

RoleExists ( string roleName ) : bool

Gets a value indicating whether the specified role name already exists in the role data source for the configured applicationName.

RolesCacheKey ( string userName ) : string

Gets the roles cache key.

Private Methods

Méthode Description
ConnectToDatabase ( ) : DapperContext

Connects to database.

CreateTablesIfNeeded ( ) : void

Creates the tables if needed.

FindRoleId ( DapperContext db, string roleName ) : int

Finds the role id.

GetRoleIdsFromNames ( DapperContext db, string roleNames ) : List

Gets the role ids from names.

GetUserIdsFromNames ( DapperContext db, string usernames ) : List

Gets the user ids from names.

VerifyInitialized ( ) : void

Verifies the initialized.

Method Details

AddCache() public méthode

Adds the cache.
public AddCache ( string userName, string roles ) : void
userName string Name of the user.
roles string The roles.
Résultat void

AddUsersToRoles() public méthode

Adds the specified user names to the specified roles for the configured applicationName.
public AddUsersToRoles ( string usernames, string roleNames ) : void
usernames string A string array of user names to be added to the specified roles.
roleNames string A string array of the role names to add the specified user names to.
Résultat void

CreateRole() public méthode

Adds a new role to the data source for the configured applicationName.
public CreateRole ( string roleName ) : void
roleName string The name of the role to create.
Résultat void

DeleteRole() public méthode

Removes a role from the data source for the configured applicationName.
public DeleteRole ( string roleName, bool throwOnPopulatedRole ) : bool
roleName string The name of the role to delete.
throwOnPopulatedRole bool If true, throw an exception if has one or more members and do not delete .
Résultat bool

FindUsersInRole() public méthode

Gets an array of user names in a role where the user name contains the specified user name to match.
public FindUsersInRole ( string roleName, string usernameToMatch ) : string[]
roleName string The role to search in.
usernameToMatch string The user name to search for.
Résultat string[]

GetAllRoles() public méthode

Gets a list of all the roles for the configured applicationName.
public GetAllRoles ( ) : string[]
Résultat string[]

GetRolesForUser() public méthode

Gets a list of the roles that a specified user is in for the configured applicationName.
public GetRolesForUser ( string username ) : string[]
username string The user to return a list of roles for.
Résultat string[]

GetUsersInRole() public méthode

Gets a list of users in the specified role for the configured applicationName.
public GetUsersInRole ( string roleName ) : string[]
roleName string The name of the role to get the list of users for.
Résultat string[]

IsUserInRole() public méthode

Gets a value indicating whether the specified user is in the specified role for the configured applicationName.
public IsUserInRole ( string username, string roleName ) : bool
username string The user name to search for.
roleName string The role to search in.
Résultat bool

PhunSimpleRoleProvider() public méthode

Initializes a new instance of the SimpleRoleProvider class.
public PhunSimpleRoleProvider ( ) : System
Résultat System

PhunSimpleRoleProvider() public méthode

Initializes a new instance of the SimpleRoleProvider class.
public PhunSimpleRoleProvider ( System.Web.Security.RoleProvider previousProvider ) : System
previousProvider System.Web.Security.RoleProvider The previous provider.
Résultat System

RemoveCache() public méthode

Clears the cache.
public RemoveCache ( string userName ) : void
userName string Name of the user.
Résultat void

RemoveUsersFromRoles() public méthode

Removes the specified user names from the specified roles for the configured applicationName.
///
public RemoveUsersFromRoles ( string usernames, string roleNames ) : void
usernames string A string array of user names to be removed from the specified roles.
roleNames string A string array of role names to remove the specified user names from.
Résultat void

RoleExists() public méthode

Gets a value indicating whether the specified role name already exists in the role data source for the configured applicationName.
public RoleExists ( string roleName ) : bool
roleName string The name of the role to search for in the data source.
Résultat bool

RolesCacheKey() public méthode

Gets the roles cache key.
public RolesCacheKey ( string userName ) : string
userName string
Résultat string