SaaS CMS has officially launched! Learn more now.

Class AuthorizePermissionAttribute

When added to an MVC controller this action filter checks permissions to functions

Inheritance
System.Object
AuthorizePermissionAttribute
Implements
Microsoft.AspNetCore.Mvc.Filters.IAuthorizationFilter
Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata
Namespace: EPiServer.Web.Mvc
Assembly: EPiServer.Cms.AspNetCore.Mvc.dll
Version: 12.0.3
Syntax
public class AuthorizePermissionAttribute : ActionFilterAttribute, IAuthorizationFilter, IFilterMetadata

Constructors

AuthorizePermissionAttribute()

Creates a AuthorizePermissionAttribute attribute.

Declaration
public AuthorizePermissionAttribute()

AuthorizePermissionAttribute(String, String)

Creates a AuthorizePermissionAttribute attribute.

Declaration
public AuthorizePermissionAttribute(string groupName, string name)
Parameters
Type Name Description
System.String groupName
System.String name

Properties

Permission

The permission to check for

Declaration
public PermissionType Permission { get; set; }
Property Value
Type Description
PermissionType

Methods

OnAuthorization(AuthorizationFilterContext)

Authorizes the request and sets the result to Microsoft.AspNetCore.Mvc.UnauthorizedResult if the user doesn't have the required permission

Declaration
public void OnAuthorization(AuthorizationFilterContext filterContext)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Filters.AuthorizationFilterContext filterContext

The filter context to set results to.

Implements

Microsoft.AspNetCore.Mvc.Filters.IAuthorizationFilter
Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata

Extension Methods