CSLA.NET
6.0.0
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
//-----------------------------------------------------------------------
8
using
System.Threading.Tasks;
9
using
Microsoft
.AspNetCore.Authorization;
10
11
namespace
Csla.Blazor
12
{
16
public
class
CslaPermissionsHandler
: AuthorizationHandler<CslaPermissionRequirement>
17
{
18
private
ApplicationContext
ApplicationContext
{
get
;
set
; }
19
24
public
CslaPermissionsHandler
(
ApplicationContext
applicationContext)
25
{
26
ApplicationContext
= applicationContext;
27
}
28
35
protected
override
Task
HandleRequirementAsync
(AuthorizationHandlerContext context,
CslaPermissionRequirement
requirement)
36
{
37
if
(Rules.BusinessRules.HasPermission(
ApplicationContext
, requirement.
Action
, requirement.
ObjectType
))
38
context.Succeed(requirement);
39
else
40
context.Fail();
41
return
Task.CompletedTask;
42
}
43
}
44
}
Csla.ApplicationContext
Provides consistent context information between the client and server DataPortal objects.
Definition:
ApplicationContext.cs:22
Csla.Blazor.CslaPermissionRequirement
CSLA permissions requirement.
Definition:
Csla.Blazor/CslaPermissionRequirement.cs:17
Csla.Blazor.CslaPermissionRequirement.Action
Rules.AuthorizationActions Action
Gets or sets the authorization action
Definition:
Csla.Blazor/CslaPermissionRequirement.cs:32
Csla.Blazor.CslaPermissionRequirement.ObjectType
Type ObjectType
Gets or sets the business object type
Definition:
Csla.Blazor/CslaPermissionRequirement.cs:36
Csla.Blazor.CslaPermissionsHandler
Authorization handler for CSLA permissions.
Definition:
HasPermissionHandler.cs:17
Csla.Blazor.CslaPermissionsHandler.HandleRequirementAsync
override Task HandleRequirementAsync(AuthorizationHandlerContext context, CslaPermissionRequirement requirement)
Handle requirements
Definition:
HasPermissionHandler.cs:35
Csla.Blazor.CslaPermissionsHandler.CslaPermissionsHandler
CslaPermissionsHandler(ApplicationContext applicationContext)
Creates an instance of the type.
Definition:
HasPermissionHandler.cs:24
Csla.Blazor
Definition:
ApplicationContextTests.cs:12
Microsoft
Definition:
ServiceCollectionExtensions.cs:17
Generated by
1.9.2