Class VisitorGroupRole
The VisitorGroupRole class holds a VisitorGroup and its VisitorGroupCriterion collection.
Implements
Inherited Members
Namespace: EPiServer.Personalization.VisitorGroups
Assembly: EPiServer.Framework.AspNetCore.dll
Version: 12.0.3Syntax
public class VisitorGroupRole : VirtualRoleProviderBase, IInitializableVirtualRole
Constructors
VisitorGroupRole()
Initializes a new instance of the VisitorGroupRole class.
Declaration
public VisitorGroupRole()
VisitorGroupRole(VisitorGroup, IVisitorGroupRepository, IVisitorGroupStatisticsLogger, ICriterionFactory, IAggregatedPersonalizationEvaluator, IHttpContextAccessor)
Initializes a new instance of the VisitorGroupRole class.
Declaration
public VisitorGroupRole(VisitorGroup visitorGroup, IVisitorGroupRepository visitorGroupRepository, IVisitorGroupStatisticsLogger visitorGroupStatisticsLogger, ICriterionFactory criterionFactory, IAggregatedPersonalizationEvaluator personalizationEvaluator, IHttpContextAccessor httpContextAccessor)
Parameters
Type | Name | Description |
---|---|---|
VisitorGroup | visitorGroup | |
IVisitorGroupRepository | visitorGroupRepository | |
IVisitorGroupStatisticsLogger | visitorGroupStatisticsLogger | |
ICriterionFactory | criterionFactory | |
IAggregatedPersonalizationEvaluator | personalizationEvaluator | |
Microsoft.AspNetCore.Http.IHttpContextAccessor | httpContextAccessor |
Fields
ImpersonatedVisitorGroupByID
Key to httpContext Items to get array of impersonated groups id for current request
Declaration
public const string ImpersonatedVisitorGroupByID = "ImpersonatedVisitorGroupsById"
Field Value
Type | Description |
---|---|
System.String |
ImpersonatedVisitorGroupByName
Key to httpContext Items to get array of impersonated groups name for current request
Declaration
public const string ImpersonatedVisitorGroupByName = "ImpersonatedVisitorGroupsByName"
Field Value
Type | Description |
---|---|
System.String |
VisitorGroupKeyByID
Query string key to set impersonation to visitor groups by id
Declaration
public const string VisitorGroupKeyByID = "visitorgroupsByID"
Field Value
Type | Description |
---|---|
System.String |
VisitorGroupKeyByName
Query string key to set impersonation to visitor groups by name
Declaration
public const string VisitorGroupKeyByName = "visitorgroupsByName"
Field Value
Type | Description |
---|---|
System.String |
Properties
ID
Gets the ID for the visitor group which is wrapped by virtual Role provider.
Declaration
public virtual Guid ID { get; }
Property Value
Type | Description |
---|---|
System.Guid | The ID. |
Name
Gets the friendly name used to refer to the provider during configuration.
Declaration
public override string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
StatisticsLogger
Gets the visitor group statistics logger.
Declaration
protected IVisitorGroupStatisticsLogger StatisticsLogger { get; }
Property Value
Type | Description |
---|---|
IVisitorGroupStatisticsLogger | The visitor group statistics logger. |
VisitorGroupRepository
Accessor for visitor group repository
Declaration
protected IVisitorGroupRepository VisitorGroupRepository { get; }
Property Value
Type | Description |
---|---|
IVisitorGroupRepository |
Methods
AddVisitorGroupStatistics(Boolean, HttpContext)
Adds statistics for visitor groups if statistics is enabled.
Declaration
public virtual void AddVisitorGroupStatistics(bool isMatch, HttpContext httpContext)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isMatch | if set to |
Microsoft.AspNetCore.Http.HttpContext | httpContext | The HTTP context. |
Initialize(String)
Initializes the provider.
Declaration
public void Initialize(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The friendly name of the provider. |
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. |
Overrides
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The name of the provider is null. |
System.ArgumentException | The name of the provider has a length of zero. |
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. |
IsInVirtualRole(IPrincipal, Object)
Determines whether the specified principal is a member of this role.
Declaration
public override bool IsInVirtualRole(IPrincipal principal, object context)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
System.Object | context | The object context. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
Remarks
The context parameter may be null but can be used to transfer external context to a Virtual role provider.
IsMatch(IPrincipal, HttpContext)
Determines whether the specified principal is a member of this role.
Declaration
public bool IsMatch(IPrincipal principal, HttpContext httpContext)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Microsoft.AspNetCore.Http.HttpContext | httpContext | The HTTP context. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
The context parameter may be null but can be used to transfer external context to a Virtual role provider