November Happy Hour will be moved to Thursday December 5th.

Class FilterAccess

Filter pages for the current user based on a required access level

Inheritance
System.Object
FilterAccess
Implements
Namespace: EPiServer.Filters
Assembly: EPiServer.Cms.AspNetCore.dll
Version: 12.0.3
Syntax
public class FilterAccess : ContentFilterBase, IContentFilter

Constructors

FilterAccess()

Initializes a new instance of the FilterAccess class.

Declaration
public FilterAccess()
Remarks

Will default to AccessLevel.Read, i e the current user must have at least read access to the page otherwise it will be removed from the list.

FilterAccess(AccessLevel)

Initializes a new instance of the FilterAccess class.

Declaration
public FilterAccess(AccessLevel requiredAccess)
Parameters
Type Name Description
AccessLevel requiredAccess

The required access level.

Properties

RequiredAccess

Gets or sets the required access level.

Declaration
public AccessLevel RequiredAccess { get; set; }
Property Value
Type Description
AccessLevel

The required access.

SimpleFilter

A simple filter only checks explicit access rights and ignores published state

Declaration
public bool SimpleFilter { get; set; }
Property Value
Type Description
System.Boolean

True to enable simple filtering, default is false

Methods

QueryDistinctAccessEdit(IContent, AccessLevel)

Return the distinct access level that the current user has to this content.

Declaration
public static bool QueryDistinctAccessEdit(IContent content, AccessLevel requestedLevel)
Parameters
Type Name Description
IContent content

The content.

AccessLevel requestedLevel

The requested level

Returns
Type Description
System.Boolean

true if user has access else false

Remarks

Note that this method also checks the published status of the page to determine the actual access that the user has. I e if the page is not published the user will not see it unless he has "more" access than Read.

QueryDistinctAccessEdit(IContent, AccessLevel, Nullable<DateTime>)

Queries the distinct access edit.

Declaration
public static bool QueryDistinctAccessEdit(IContent content, AccessLevel requestedLevel, Nullable<DateTime> requestTime)
Parameters
Type Name Description
IContent content

The content.

AccessLevel requestedLevel

The requested level.

System.Nullable<System.DateTime> requestTime

The request time.

Returns
Type Description
System.Boolean

QueryDistinctAccessEdit(IContent, AccessLevel, IPrincipal)

Queries the distinct access edit.

Declaration
public static bool QueryDistinctAccessEdit(IContent content, AccessLevel requestedLevel, IPrincipal principal)
Parameters
Type Name Description
IContent content

The content.

AccessLevel requestedLevel

The requested level.

System.Security.Principal.IPrincipal principal

The principal.

Returns
Type Description
System.Boolean

QueryDistinctAccessEdit(IContent, AccessLevel, IPrincipal, Nullable<DateTime>)

Queries the distinct access edit.

Declaration
public static bool QueryDistinctAccessEdit(IContent content, AccessLevel requestedLevel, IPrincipal principal, Nullable<DateTime> requestTime)
Parameters
Type Name Description
IContent content

The content.

AccessLevel requestedLevel

The requested level.

System.Security.Principal.IPrincipal principal

The principal

System.Nullable<System.DateTime> requestTime

The request time.

Returns
Type Description
System.Boolean

ShouldFilter(IContent)

Should filter.

Declaration
public override bool ShouldFilter(IContent content)
Parameters
Type Name Description
IContent content

The content.

Returns
Type Description
System.Boolean
Overrides

Implements

Extension Methods