|
| 1 | +//****************************************************************************************************** |
| 2 | +// ClaimQueryRestrictionAttribute.cs - Gbtc |
| 3 | +// |
| 4 | +// Copyright © 2026, Grid Protection Alliance. All Rights Reserved. |
| 5 | +// |
| 6 | +// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See |
| 7 | +// the NOTICE file distributed with this work for additional information regarding copyright ownership. |
| 8 | +// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may |
| 9 | +// not use this file except in compliance with the License. You may obtain a copy of the License at: |
| 10 | +// |
| 11 | +// http://opensource.org/licenses/MIT |
| 12 | +// |
| 13 | +// Unless agreed to in writing, the subject software distributed under the License is distributed on an |
| 14 | +// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the |
| 15 | +// License for the specific language governing permissions and limitations. |
| 16 | +// |
| 17 | +// Code Modification History: |
| 18 | +// ---------------------------------------------------------------------------------------------------- |
| 19 | +// 01/09/2026 - J. Ritchie Carroll |
| 20 | +// Generated original version of source code. |
| 21 | +// |
| 22 | +//****************************************************************************************************** |
| 23 | + |
| 24 | +using System; |
| 25 | +using System.Data; |
| 26 | + |
| 27 | +namespace Gemstone.Data.Model; |
| 28 | + |
| 29 | +/// <summary> |
| 30 | +/// Defines an attribute that will mark a modeled table static function as a method to create a <see cref="RecordRestriction"/> |
| 31 | +/// to secure query functions for a modeled <see cref="SecureTableOperations{T}"/>. |
| 32 | +/// </summary> |
| 33 | +/// <remarks>The static function should be a part of the modeled class, and have the footprint |
| 34 | +/// <see cref="RecordRestriction"/> MethodName(<see langword="params"/> <see cref="object"/>[])</remarks> |
| 35 | +[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] |
| 36 | +public sealed class ClaimRestrictionAttribute : Attribute |
| 37 | +{ |
| 38 | + |
| 39 | + /// <summary> |
| 40 | + /// Defines claims which will be checked for parameter values |
| 41 | + /// </summary> |
| 42 | + public readonly string[] Claims; |
| 43 | + |
| 44 | + /// <summary> |
| 45 | + /// Creates a new parameterized <see cref="ClaimRestrictionAttribute"/> with the specified claims. |
| 46 | + /// </summary> |
| 47 | + /// <param name="claims">Claims to use for parameter values. The order of parameters is in the same order as claims, grabbing as many values as each claim provides</param> |
| 48 | + public ClaimRestrictionAttribute(params string[] claims) |
| 49 | + { |
| 50 | + Claims = claims ?? throw new ArgumentNullException(nameof(claims)); |
| 51 | + } |
| 52 | +} |
0 commit comments