CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
HasPermissionHandler.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="CslaPermissionsHandler.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Authorization handler for CSLA permissions</summary>
7//-----------------------------------------------------------------------
8using System.Threading.Tasks;
9using Microsoft.AspNetCore.Authorization;
10
11namespace Csla.Blazor
12{
16 public class CslaPermissionsHandler : AuthorizationHandler<CslaPermissionRequirement>
17 {
24 protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, CslaPermissionRequirement requirement)
25 {
26 if (Rules.BusinessRules.HasPermission(requirement.Action, requirement.ObjectType))
27 context.Succeed(requirement);
28 else
29 context.Fail();
30 return Task.CompletedTask;
31 }
32 }
33}
Rules.AuthorizationActions Action
Gets or sets the authorization action
Type ObjectType
Gets or sets the business object type
Authorization handler for CSLA permissions.
override Task HandleRequirementAsync(AuthorizationHandlerContext context, CslaPermissionRequirement requirement)
Handle requirements