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.
DataPortalOperationExtensions.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="DataPortalOperationExtensions.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Object containing information about the</summary>
7//-----------------------------------------------------------------------
8using System;
9using Csla.Rules;
10
11namespace Csla
12{
16 internal static class DataPortalOperationExtensions
17 {
18 internal static AuthorizationActions ToAuthAction(this DataPortalOperations operation)
19 {
20 switch (operation)
21 {
22 case DataPortalOperations.Create:
23 return AuthorizationActions.CreateObject;
24 case DataPortalOperations.Fetch:
25 return AuthorizationActions.GetObject;
26 case DataPortalOperations.Update:
27 return AuthorizationActions.EditObject;
28 case DataPortalOperations.Delete:
29 return AuthorizationActions.DeleteObject;
30 case DataPortalOperations.Execute:
31 // CSLA handles Execute/CommandObject as Update operations
32 // - this is the permission that the client DataPortal checks.
33 return AuthorizationActions.EditObject;
34 default:
35 throw new ArgumentOutOfRangeException("operation");
36 }
37 }
38
39 internal static string ToSecurityActionDescription(this DataPortalOperations operation)
40 {
41 switch (operation)
42 {
43 case DataPortalOperations.Create:
44 return "create";
45 case DataPortalOperations.Fetch:
46 return "get";
47 case DataPortalOperations.Update:
48 return "save";
49 case DataPortalOperations.Delete:
50 return "delete";
51 case DataPortalOperations.Execute:
52 return "execute";
53 default:
54 throw new ArgumentOutOfRangeException("operation");
55 }
56 }
57 }
58}
AuthorizationActions
Authorization actions.
DataPortalOperations
List of data portal operations.