C# Class BlogEngine.Core.Providers.DbRoleProvider

Generic Db Role Provider
Inheritance: System.Web.Security.RoleProvider
Show file Open project: rasmuskl/ReSharperCourse

Public Methods

Method Description
AddUsersToRoles ( string usernames, string roleNames ) : void

Adds all users in user array to all roles in role array

CreateRole ( string roleName ) : void

Adds a new role to the database

DeleteRole ( string roleName, bool throwOnPopulatedRole ) : bool

Removes a role from database

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

Returns all users in selected role with names that match usernameToMatch

GetAllRoles ( ) : string[]

Returns array of all roles in database

GetRolesForUser ( string username ) : string[]

Return an array of roles that user is in

GetUsersInRole ( string roleName ) : string[]

Returns array of users in selected role

Initialize ( string name, NameValueCollection config ) : void

Initializes the provider

IsUserInRole ( string username, string roleName ) : bool

Check to see if user is in a role

RemoveUsersFromRoles ( string usernames, string roleNames ) : void

Removes all users in user array from all roles in role array

RoleExists ( string roleName ) : bool

Checks to see if role exists

Private Methods

Method Description
CreateConnection ( ) : DbConnectionHelper
FormatParamName ( string parameterName ) : string

Returns a formatted parameter name to include this DbRoleProvider instance's paramPrefix.

Method Details

AddUsersToRoles() public method

Adds all users in user array to all roles in role array
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.
return void

CreateRole() public method

Adds a new role to the database
public CreateRole ( string roleName ) : void
roleName string The name of the role to create.
return void

DeleteRole() public method

Removes a role from database
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 .
return bool

FindUsersInRole() public method

Returns all users in selected role with names that match usernameToMatch
public FindUsersInRole ( string roleName, string usernameToMatch ) : string[]
roleName string The role to search in.
usernameToMatch string The user name to search for.
return string[]

GetAllRoles() public method

Returns array of all roles in database
public GetAllRoles ( ) : string[]
return string[]

GetRolesForUser() public method

Return an array of roles that user is in
public GetRolesForUser ( string username ) : string[]
username string The user to return a list of roles for.
return string[]

GetUsersInRole() public method

Returns array of users in selected role
public GetUsersInRole ( string roleName ) : string[]
roleName string The name of the role to get the list of users for.
return string[]

Initialize() public method

Initializes the provider
public Initialize ( string name, NameValueCollection config ) : void
name string /// Configuration name ///
config System.Collections.Specialized.NameValueCollection /// Configuration settings ///
return void

IsUserInRole() public method

Check to see if user is in a role
public IsUserInRole ( string username, string roleName ) : bool
username string The user name to search for.
roleName string The role to search in.
return bool

RemoveUsersFromRoles() public method

Removes all users in user array from all roles in role array
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.
return void

RoleExists() public method

Checks to see if role exists
public RoleExists ( string roleName ) : bool
roleName string The name of the role to search for in the data source.
return bool