Try our conversational search powered by Generative AI!

Interface IVirtualRoleRepository

Signature for a virtual role repository

Namespace: EPiServer.Security
Assembly: EPiServer.Framework.dll
Version: 11.20.7
Syntax
public interface IVirtualRoleRepository

Methods

GetAllRoles()

Get a list of all registered virtual roles in this repository.

Declaration
IEnumerable<string> GetAllRoles()
Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

A list of virtual role names.

GetRoleNamesByType(Type)

Gets the virtual role names for a specified type.

Declaration
IEnumerable<string> GetRoleNamesByType(Type type)
Parameters
Type Name Description
System.Type type

Type of the class.

Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

The role names.

Register(String, VirtualRoleProviderBase)

Register a new virtual role

Declaration
void Register(string name, VirtualRoleProviderBase provider)
Parameters
Type Name Description
System.String name

Name of the role

VirtualRoleProviderBase provider

The implementation

Remarks

This method will overwrite any existing registered virtual roles with the same name. No events will be raised with this overload.

Register(String, Type, Boolean)

Register a new virtual role and return the instance T.

Declaration
void Register(string name, Type virtualRoleProviderType, bool replicateChanges)
Parameters
Type Name Description
System.String name

Name of the role

System.Type virtualRoleProviderType

The type of the implementation

System.Boolean replicateChanges

True if changes should be replicated to other instances or machines

Remarks

This method will overwrite any existing registered virtual roles with the same name

SearchRoles(String)

Find virtual roles registered in this repository

Declaration
IEnumerable<string> SearchRoles(string query)
Parameters
Type Name Description
System.String query

Query to find roles from.

Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

A list of roles that match the roleName

Remarks

Matching of role names is simply a substring check - if the role contains the string passed in roleName anywhere in the string, it is considered a match.

TryGetRole(String, out VirtualRoleProviderBase)

Get a role based on name

Declaration
bool TryGetRole(string role, out VirtualRoleProviderBase virtualRole)
Parameters
Type Name Description
System.String role

Name of the role

VirtualRoleProviderBase virtualRole

The virtual role provider registered for this name

Returns
Type Description
System.Boolean

True if the role was found

Unregister(String, Boolean)

Unregister a virtual role

Declaration
void Unregister(string name, bool replicateChanges)
Parameters
Type Name Description
System.String name

The name of the role

System.Boolean replicateChanges

Replicate changes to all instences of this class

Extension Methods