| | | 1 | | using Elsa.Authorization; |
| | | 2 | | using Elsa.Permissions; |
| | | 3 | | using JetBrains.Annotations; |
| | | 4 | | |
| | | 5 | | namespace Elsa.Secrets.Permissions; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// Stable resource names for Secrets. Endpoints reference these constants rather than string |
| | | 9 | | /// literals, and the descriptors below are declared alongside them so the two cannot drift. |
| | | 10 | | /// </summary> |
| | | 11 | | public static class SecretsResourcePermissions |
| | | 12 | | { |
| | | 13 | | /// <summary>Manage secret records, including rotation and revocation.</summary> |
| | | 14 | | public const string Secrets = "secrets"; |
| | | 15 | | } |
| | | 16 | | |
| | | 17 | | /// <summary>Contributes the Secrets resources to the permission catalog.</summary> |
| | | 18 | | [UsedImplicitly] |
| | | 19 | | public sealed class SecretsResourcePermissionsDescriptorProvider : IPermissionDescriptorProvider |
| | | 20 | | { |
| | | 21 | | /// <inheritdoc /> |
| | | 22 | | public IEnumerable<PermissionDescriptor> GetDescriptors() => |
| | 0 | 23 | | [ |
| | 0 | 24 | | new(SecretsResourcePermissions.Secrets, [CoreVerbs.View, CoreVerbs.Write, CoreVerbs.Delete, "test"], "Secrets", |
| | 0 | 25 | | ]; |
| | | 26 | | } |