8#if !NETSTANDARD2_0 && !NETCORE3_1 && !NET5_0
19 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple =
true, Inherited =
true)]
22 private const string ERROR_MSG =
"Authorization denied.";
24 private Type _objectType;
25 private string _errorMsg = ERROR_MSG;
35 _objectType = objectType;
45 : this(action, objectType)
70 if (filterContext.HttpContext.Request.IsAjaxRequest())
72 filterContext.HttpContext.Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
73 filterContext.Result =
new JsonResult()
75 JsonRequestBehavior = JsonRequestBehavior.AllowGet,
78 ErrorType = this.GetType().Name,
79 Action = filterContext.ActionDescriptor.ActionName,
86 base.HandleUnauthorizedRequest(filterContext);
Tracks the business rules for a business object.
static bool HasPermission(AuthorizationActions action, Type objectType)
Checks per-type authorization rules.
Restricts callers to an action method.
override bool AuthorizeCore(HttpContextBase httpContext)
Determines whether access to the core framework is authorized.
HasPermissionAttribute(AuthorizationActions action, Type objectType, string message)
Creates an instance of the type.
HasPermissionAttribute(AuthorizationActions action, Type objectType)
Creates an instance of the type.
override void HandleUnauthorizedRequest(System.Web.Mvc.AuthorizationContext filterContext)
Processes HTTP requests that fail authorization and handles AJAX requests appropriately.
AuthorizationActions
Authorization actions.