diff --git a/src/modules/Elsa.Labels/Endpoints/Labels/Delete/Constants.cs b/src/modules/Elsa.Labels/Endpoints/Labels/Delete/Constants.cs deleted file mode 100644 index e93c370d8..000000000 --- a/src/modules/Elsa.Labels/Endpoints/Labels/Delete/Constants.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Elsa.Labels.Endpoints.Labels.Delete; - -/// -/// Provides policy names accepted by the endpoint. -/// -public static class Constants -{ - /// - /// The policy name accepted by this endpoint. - /// - public const string PolicyName = "DeleteLabel"; -} \ No newline at end of file diff --git a/src/modules/Elsa.Labels/Endpoints/Labels/Delete/Endpoint.cs b/src/modules/Elsa.Labels/Endpoints/Labels/Delete/Endpoint.cs index 429019826..3abd424f5 100644 --- a/src/modules/Elsa.Labels/Endpoints/Labels/Delete/Endpoint.cs +++ b/src/modules/Elsa.Labels/Endpoints/Labels/Delete/Endpoint.cs @@ -1,9 +1,10 @@ +using Elsa.Abstractions; using Elsa.Labels.Contracts; using FastEndpoints; namespace Elsa.Labels.Endpoints.Labels.Delete; -public class Delete : Endpoint +public class Delete : ElsaEndpoint { private readonly ILabelStore _store; @@ -12,7 +13,7 @@ public class Delete : Endpoint public override void Configure() { Delete("/labels/{id}"); - Policies(Constants.PolicyName); + ConfigurePermissions("delete:labels"); } public override async Task HandleAsync(Request request, CancellationToken cancellationToken) diff --git a/src/modules/Elsa.Labels/Endpoints/Labels/Get/Constants.cs b/src/modules/Elsa.Labels/Endpoints/Labels/Get/Constants.cs deleted file mode 100644 index 7b75082e6..000000000 --- a/src/modules/Elsa.Labels/Endpoints/Labels/Get/Constants.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Elsa.Labels.Endpoints.Labels.Get; - -/// -/// Provides policy names accepted by the endpoint. -/// -public static class Constants -{ - /// - /// The policy name accepted by this endpoint. - /// - public const string PolicyName = "GetLabel"; -} \ No newline at end of file diff --git a/src/modules/Elsa.Labels/Endpoints/Labels/Get/Endpoint.cs b/src/modules/Elsa.Labels/Endpoints/Labels/Get/Endpoint.cs index ba1852418..173c943f0 100644 --- a/src/modules/Elsa.Labels/Endpoints/Labels/Get/Endpoint.cs +++ b/src/modules/Elsa.Labels/Endpoints/Labels/Get/Endpoint.cs @@ -1,9 +1,10 @@ +using Elsa.Abstractions; using Elsa.Labels.Contracts; using FastEndpoints; namespace Elsa.Labels.Endpoints.Labels.Get; -internal class Get : Endpoint +internal class Get : ElsaEndpoint { private readonly ILabelStore _store; @@ -15,7 +16,7 @@ internal class Get : Endpoint public override void Configure() { Get("/labels/{id}"); - Policies(Constants.PolicyName); + ConfigurePermissions("read:labels"); } public override async Task HandleAsync(Request request, CancellationToken cancellationToken) diff --git a/src/modules/Elsa.Labels/Endpoints/Labels/List/Constants.cs b/src/modules/Elsa.Labels/Endpoints/Labels/List/Constants.cs deleted file mode 100644 index f9c230920..000000000 --- a/src/modules/Elsa.Labels/Endpoints/Labels/List/Constants.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Elsa.Labels.Endpoints.Labels.List; - -/// -/// Provides policy names accepted by the endpoint. -/// -public static class Constants -{ - /// - /// The policy name accepted by this endpoint. - /// - public const string PolicyName = "ListLabels"; -} \ No newline at end of file diff --git a/src/modules/Elsa.Labels/Endpoints/Labels/List/Endpoint.cs b/src/modules/Elsa.Labels/Endpoints/Labels/List/Endpoint.cs index bb35d3dbb..c0003ad29 100644 --- a/src/modules/Elsa.Labels/Endpoints/Labels/List/Endpoint.cs +++ b/src/modules/Elsa.Labels/Endpoints/Labels/List/Endpoint.cs @@ -1,9 +1,10 @@ +using Elsa.Abstractions; using Elsa.Labels.Contracts; using FastEndpoints; namespace Elsa.Labels.Endpoints.Labels.List; -public class List : Endpoint +public class List : ElsaEndpoint { private readonly ILabelStore _store; @@ -15,7 +16,7 @@ public class List : Endpoint public override void Configure() { Get("/labels"); - Policies(Constants.PolicyName); + ConfigurePermissions("read:labels"); } public override async Task ExecuteAsync(Request request, CancellationToken cancellationToken) diff --git a/src/modules/Elsa.Labels/Endpoints/Labels/Post/Constants.cs b/src/modules/Elsa.Labels/Endpoints/Labels/Post/Constants.cs deleted file mode 100644 index 0d147d34d..000000000 --- a/src/modules/Elsa.Labels/Endpoints/Labels/Post/Constants.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Elsa.Labels.Endpoints.Labels.Post; - -/// -/// Provides policy names accepted by the endpoint. -/// -public static class Constants -{ - /// - /// The policy name accepted by this endpoint. - /// - public const string PolicyName = "CreateLabel"; -} \ No newline at end of file diff --git a/src/modules/Elsa.Labels/Endpoints/Labels/Post/Endpoint.cs b/src/modules/Elsa.Labels/Endpoints/Labels/Post/Endpoint.cs index f6730b090..4379e1fc1 100644 --- a/src/modules/Elsa.Labels/Endpoints/Labels/Post/Endpoint.cs +++ b/src/modules/Elsa.Labels/Endpoints/Labels/Post/Endpoint.cs @@ -1,3 +1,4 @@ +using Elsa.Abstractions; using Elsa.Labels.Contracts; using Elsa.Workflows; using FastEndpoints; @@ -6,7 +7,7 @@ using JetBrains.Annotations; namespace Elsa.Labels.Endpoints.Labels.Post; [PublicAPI] -internal class Create : Endpoint +internal class Create : ElsaEndpoint { private readonly ILabelStore _store; @@ -18,7 +19,7 @@ internal class Create : Endpoint public override void Configure() { Post("/labels"); - Policies(Constants.PolicyName); + ConfigurePermissions("create:labels"); } public override async Task HandleAsync(Request request, CancellationToken cancellationToken) diff --git a/src/modules/Elsa.Labels/Endpoints/Labels/Update/Constants.cs b/src/modules/Elsa.Labels/Endpoints/Labels/Update/Constants.cs deleted file mode 100644 index a58531fd8..000000000 --- a/src/modules/Elsa.Labels/Endpoints/Labels/Update/Constants.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Elsa.Labels.Endpoints.Labels.Update; - -/// -/// Provides policy names accepted by the endpoint. -/// -public static class Constants -{ - /// - /// The policy name accepted by this endpoint. - /// - public const string PolicyName = "UpdateLabel"; -} \ No newline at end of file diff --git a/src/modules/Elsa.Labels/Endpoints/Labels/Update/Update.cs b/src/modules/Elsa.Labels/Endpoints/Labels/Update/Update.cs index f54dfbb48..5d6003479 100644 --- a/src/modules/Elsa.Labels/Endpoints/Labels/Update/Update.cs +++ b/src/modules/Elsa.Labels/Endpoints/Labels/Update/Update.cs @@ -1,3 +1,4 @@ +using Elsa.Abstractions; using Elsa.Labels.Contracts; using FastEndpoints; using JetBrains.Annotations; @@ -5,12 +6,12 @@ using JetBrains.Annotations; namespace Elsa.Labels.Endpoints.Labels.Update; [PublicAPI] -internal class Update(ILabelStore store) : Endpoint +internal class Update(ILabelStore store) : ElsaEndpoint { public override void Configure() { Post("/labels/{id}"); - Policies(Constants.PolicyName); + ConfigurePermissions("update:labels"); } public override async Task HandleAsync(Request request, CancellationToken cancellationToken) diff --git a/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/List/Constants.cs b/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/List/Constants.cs deleted file mode 100644 index 0d7224871..000000000 --- a/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/List/Constants.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Elsa.Labels.Endpoints.WorkflowDefinitionLabels.List; - -/// -/// Provides policy names accepted by the endpoint. -/// -public static class Constants -{ - /// - /// The policy name accepted by this endpoint. - /// - public const string PolicyName = "ListWorkflowDefinitionLabels"; -} \ No newline at end of file diff --git a/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/List/Endpoint.cs b/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/List/Endpoint.cs index 91098ab3d..0a33c243f 100644 --- a/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/List/Endpoint.cs +++ b/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/List/Endpoint.cs @@ -1,14 +1,14 @@ +using Elsa.Abstractions; using Elsa.Labels.Contracts; using Elsa.Workflows.Management; using Elsa.Workflows.Management.Filters; -using FastEndpoints; using JetBrains.Annotations; using Open.Linq.AsyncExtensions; namespace Elsa.Labels.Endpoints.WorkflowDefinitionLabels.List; [PublicAPI] -internal class List : Endpoint +internal class List : ElsaEndpoint { private readonly IWorkflowDefinitionStore _workflowDefinitionStore; private readonly IWorkflowDefinitionLabelStore _workflowDefinitionLabelStore; @@ -24,7 +24,7 @@ internal class List : Endpoint public override void Configure() { Get("/workflow-definitions/{id}/labels"); - Policies(Constants.PolicyName); + ConfigurePermissions("read:workflow-definition-labels"); } public override async Task HandleAsync(Request request, CancellationToken cancellationToken) diff --git a/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/Update/Constants.cs b/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/Update/Constants.cs deleted file mode 100644 index f9c0c8c16..000000000 --- a/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/Update/Constants.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Elsa.Labels.Endpoints.WorkflowDefinitionLabels.Update; - -/// -/// Provides policy names accepted by the endpoint. -/// -public static class Constants -{ - /// - /// The policy name accepted by this endpoint. - /// - public const string PolicyName = "UpdateWorkflowDefinitionLabels"; -} \ No newline at end of file diff --git a/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/Update/Endpoint.cs b/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/Update/Endpoint.cs index 72c480740..c3ea80a6c 100644 --- a/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/Update/Endpoint.cs +++ b/src/modules/Elsa.Labels/Endpoints/WorkflowDefinitionLabels/Update/Endpoint.cs @@ -1,3 +1,4 @@ +using Elsa.Abstractions; using Elsa.Labels.Contracts; using Elsa.Labels.Entities; using Elsa.Workflows; @@ -11,7 +12,7 @@ using Open.Linq.AsyncExtensions; namespace Elsa.Labels.Endpoints.WorkflowDefinitionLabels.Update; [PublicAPI] -internal class Update : Endpoint +internal class Update : ElsaEndpoint { private readonly ILabelStore _labelStore; private readonly IWorkflowDefinitionStore _workflowDefinitionStore; @@ -42,7 +43,7 @@ internal class Update : Endpoint public override void Configure() { Post("/workflow-definitions/{id}/labels"); - Policies(Constants.PolicyName); + ConfigurePermissions("update:workflow-definition-labels"); } public override async Task HandleAsync(Request request, CancellationToken cancellationToken)