Class MultiplexingRoleProvider
A role provider implementation that acts as a multiplexer between a number of preconfigured role providers.
Inheritance
Namespace: EPiServer.Security
Assembly: EPiServer.Framework.dll
Version: 10.10.4Syntax
public class MultiplexingRoleProvider : RoleProvider
Constructors
MultiplexingRoleProvider()
Initializes a new instance of the MultiplexingRoleProvider class.
Declaration
public MultiplexingRoleProvider()
Properties
ActiveRoleProviders
A list of currently active role providers
Declaration
[Obsolete("This property has been replaced with Providers that is both read-only and thread-safe", true)]
public List<RoleProvider> ActiveRoleProviders { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Web.Security.RoleProvider> |
ApplicationName
Gets or sets the name of the application to store and retrieve role information for.
Declaration
public override string ApplicationName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
CurrentProvider
Currently used role provider based on the mapped membership provider
Declaration
public RoleProvider CurrentProvider { get; }
Property Value
Type | Description |
---|---|
System.Web.Security.RoleProvider |
DefaultProvider
Returns default provider that corresponds to provider1 setting in web.config.
Declaration
public RoleProvider DefaultProvider { get; }
Property Value
Type | Description |
---|---|
System.Web.Security.RoleProvider | The default provider. |
Remarks
The default role provider is used for operations such as adding a new role, where you cannot apply the operation to all providers, neither determine the role provider based on information from the multiplexing membership provider.
Providers
A list of currently active role providers (read-only)
Declaration
public IList<RoleProvider> Providers { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<System.Web.Security.RoleProvider> |
Methods
AddUsersToRoles(String[], String[])
Adds the specified user names to the specified roles for the configured applicationName.
Declaration
public override void AddUsersToRoles(string[] usernames, string[] roleNames)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | usernames | A string array of user names to be added to the specified roles. |
System.String[] | roleNames | A string array of the role names to add the specified user names to. |
CreateRole(String)
Adds a new role to the data source for the configured applicationName.
Declaration
public override void CreateRole(string roleName)
Parameters
Type | Name | Description |
---|---|---|
System.String | roleName | The name of the role to create. |
DeleteRole(String, Boolean)
Removes a role from the data source for the configured applicationName.
Declaration
public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
Parameters
Type | Name | Description |
---|---|---|
System.String | roleName | The name of the role to delete. |
System.Boolean | throwOnPopulatedRole | If true, throw an exception if roleName has one or more members and do not delete roleName. |
Returns
Type | Description |
---|---|
System.Boolean | true if the role was successfully deleted; otherwise, false. |
FindUsersInRole(String, String)
Gets an array of user names in a role where the user name contains the specified user name to match.
Declaration
public override string[] FindUsersInRole(string roleName, string usernameToMatch)
Parameters
Type | Name | Description |
---|---|---|
System.String | roleName | The role to search in. |
System.String | usernameToMatch | The user name to search for. |
Returns
Type | Description |
---|---|
System.String[] | A string array containing the names of all the users where the user name matches usernameToMatch and the user is a member of the specified role. |
GetAllRoles()
Gets a list of all the roles for the configured applicationName.
Declaration
public override string[] GetAllRoles()
Returns
Type | Description |
---|---|
System.String[] | A string array containing the names of all the roles stored in the data source for the configured applicationName. |
GetRolesForUser(String)
Gets a list of the roles that a specified user is in for the configured applicationName.
Declaration
public override string[] GetRolesForUser(string username)
Parameters
Type | Name | Description |
---|---|---|
System.String | username | The user to return a list of roles for. |
Returns
Type | Description |
---|---|
System.String[] | A string array containing the names of all the roles that the specified user is in for the configured applicationName. |
GetUsersInRole(String)
Gets a list of users in the specified role for the configured applicationName.
Declaration
public override string[] GetUsersInRole(string roleName)
Parameters
Type | Name | Description |
---|---|---|
System.String | roleName | The name of the role to get the list of users for. |
Returns
Type | Description |
---|---|
System.String[] | A string array containing the names of all the users who are members of the specified role for the configured applicationName. |
Initialize(String, NameValueCollection)
Initializes the provider.
Declaration
public override void Initialize(string name, NameValueCollection config)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The friendly name of the provider. |
System.Collections.Specialized.NameValueCollection | config | A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The name of the provider is null. |
System.InvalidOperationException | An attempt is made to call System.Configuration.Provider.ProviderBase.Initialize(System.String,System.Collections.Specialized.NameValueCollection) on a provider after the provider has already been initialized. |
System.ArgumentException | The name of the provider has a length of zero. |
IsUserInRole(String, String)
Gets a value indicating whether the specified user is in the specified role for the configured applicationName.
Declaration
public override bool IsUserInRole(string username, string roleName)
Parameters
Type | Name | Description |
---|---|---|
System.String | username | The user name to search for. |
System.String | roleName | The role to search in. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified user is in the specified role for the configured applicationName; otherwise, false. |
MembershipToRoleProvider(String)
Get the role provider that maps to a membership provider
Declaration
public RoleProvider MembershipToRoleProvider(string membershipProviderName)
Parameters
Type | Name | Description |
---|---|---|
System.String | membershipProviderName | The name of the membership provider |
Returns
Type | Description |
---|---|
System.Web.Security.RoleProvider | A role provider |
ProviderForUser(String)
Determine the currently used role provider for the user name
Declaration
public RoleProvider ProviderForUser(string userName)
Parameters
Type | Name | Description |
---|---|---|
System.String | userName | The logged in user |
Returns
Type | Description |
---|---|
System.Web.Security.RoleProvider | A role provider |
RemoveUsersFromRoles(String[], String[])
Removes the specified user names from the specified roles for the configured applicationName.
Declaration
public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | usernames | A string array of user names to be removed from the specified roles. |
System.String[] | roleNames | A string array of role names to remove the specified user names from. |
RoleExists(String)
Gets a value indicating whether the specified role name already exists in the role data source for the configured applicationName.
Declaration
public override bool RoleExists(string roleName)
Parameters
Type | Name | Description |
---|---|---|
System.String | roleName | The name of the role to search for in the data source. |
Returns
Type | Description |
---|---|
System.Boolean | true if the role name already exists in the data source for the configured applicationName; otherwise, false. |
SetCurrentMembershipUser(String)
Assign the current user to the context
Declaration
public void SetCurrentMembershipUser(string userName)
Parameters
Type | Name | Description |
---|---|---|
System.String | userName | The logged in user name |