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.
ActiveAuthorizer.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ActiveAuthorizer.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Implementation of the authorizer that</summary>
7//-----------------------------------------------------------------------
8using System;
9using Csla.Properties;
10using Csla.Rules;
11using Csla.Security;
12
13namespace Csla.Server
14{
21 {
26 public ActiveAuthorizer(ApplicationContext applicationContext)
27 {
28 ApplicationContext = applicationContext;
29 }
30
31 private ApplicationContext ApplicationContext { get; set; }
32
39 public void Authorize(AuthorizeRequest clientRequest)
40 {
43 {
44 if (clientRequest.Operation == DataPortalOperations.Update ||
45 clientRequest.Operation == DataPortalOperations.Execute)
46 {
47 // Per-Instance checks
48 if (!BusinessRules.HasPermission(ApplicationContext, clientRequest.Operation.ToAuthAction(), clientRequest.RequestObject))
49 {
50 throw new SecurityException(
52 clientRequest.Operation.ToSecurityActionDescription(),
53 clientRequest.ObjectType.Name)
54 );
55 }
56 }
57
58 // Per-Type checks
59 if (!BusinessRules.HasPermission(ApplicationContext, clientRequest.Operation.ToAuthAction(), clientRequest.ObjectType))
60 {
61 throw new SecurityException(
63 clientRequest.Operation.ToSecurityActionDescription(),
64 clientRequest.ObjectType.Name)
65 );
66 }
67 }
68 }
69 }
70}
Provides consistent context information between the client and server DataPortal objects.
LogicalExecutionLocations LogicalExecutionLocation
Return Logical Execution Location - Client or Server This is applicable to Local mode as well
ExecutionLocations ExecutionLocation
Returns a value indicating whether the application code is currently executing on the client or serve...
ExecutionLocations
Enum representing the locations code can execute.
LogicalExecutionLocations
Enum representing the logical execution location The setting is set to server when server is execting...
A strongly-typed resource class, for looking up localized strings, etc.
static string UserNotAuthorizedException
Looks up a localized string similar to User not authorized to {0} object type {1}.
Tracks the business rules for a business object.
static bool HasPermission(ApplicationContext applicationContext, AuthorizationActions action, Type objectType)
Checks per-type authorization rules.
Implementation of the authorizer that checks per-type authorization rules for each request.
ActiveAuthorizer(ApplicationContext applicationContext)
Creates an instance of the type.
void Authorize(AuthorizeRequest clientRequest)
Checks authorization rules for the request.
Object containing information about the client request to the data portal.
object RequestObject
Gets a reference to the criteria or business object passed from the client to the server.
Type ObjectType
Gets the type of business object affected by the client request.
DataPortalOperations Operation
Gets the data portal operation requested by the client.
Interface to be implemented by a custom authorization provider.
DataPortalOperations
List of data portal operations.