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.
AuthorizationContext.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="AuthorizationContext.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Context information provided to an authorization</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.ComponentModel;
10using System.Security.Claims;
11using System.Security.Principal;
12using Csla.Core;
13
14namespace Csla.Rules
15{
21 {
25 [EditorBrowsable(EditorBrowsableState.Never)]
26 public IAuthorizationRule Rule { get; internal set; }
30 public object Target { get; internal set; }
34 public Type TargetType { get; internal set; }
40 public bool HasPermission { get; set; }
41
45 public object[] Criteria { get; internal set; }
46
54 public AuthorizationContext(ApplicationContext applicationContext, IAuthorizationRule rule, object target, Type targetType)
55 {
56 ApplicationContext = applicationContext;
57 Rule = rule;
58 Target = target;
59 TargetType = targetType;
60 }
61
65 public ApplicationContext ApplicationContext { get; private set; }
66
71 (IDataPortalFactory)ApplicationContext.CurrentServiceProvider.GetService(typeof(IDataPortalFactory));
72 }
73}
Provides consistent context information between the client and server DataPortal objects.
Context information provided to an authorization rule when it is invoked.
Type TargetType
Gets the type of the target business class.
bool HasPermission
Gets or sets a value indicating whether the current user has permission to perform the requested acti...
object[] Criteria
Gets an object which is the criteria specified in the data portal call, if any.
IDataPortalFactory DataPortalFactory
Gets a data portal factory instance
AuthorizationContext(ApplicationContext applicationContext, IAuthorizationRule rule, object target, Type targetType)
Creates a AuthorizationContext instance for unit testing.
IAuthorizationRule Rule
Gets the rule object.
object Target
Gets a reference to the target business object.
Defines a data portal service used to get an access to a client-side data portal instance.
Implemented by objects which provide context information to an authorization rule when it is invoked.
Interface defining an authorization rule implementation.