| | | 1 | | using Elsa.Extensions; |
| | | 2 | | using Elsa.Features.Abstractions; |
| | | 3 | | using Elsa.Features.Attributes; |
| | | 4 | | using Elsa.Features.Services; |
| | | 5 | | using Elsa.SasTokens.Features; |
| | | 6 | | using Elsa.Workflows.Api.Constants; |
| | | 7 | | using Elsa.Workflows.Api.Requirements; |
| | | 8 | | using Elsa.Workflows.Api.Serialization; |
| | | 9 | | using Elsa.Workflows.Api.Services; |
| | | 10 | | using Elsa.Workflows.Management.Features; |
| | | 11 | | using Elsa.Workflows.Runtime.Features; |
| | | 12 | | using Microsoft.AspNetCore.Authorization; |
| | | 13 | | using Microsoft.Extensions.DependencyInjection; |
| | | 14 | | |
| | | 15 | | namespace Elsa.Workflows.Api.Features; |
| | | 16 | | |
| | | 17 | | /// <summary> |
| | | 18 | | /// Adds workflows API features. |
| | | 19 | | /// </summary> |
| | | 20 | | [DependsOn(typeof(WorkflowInstancesFeature))] |
| | | 21 | | [DependsOn(typeof(WorkflowManagementFeature))] |
| | | 22 | | [DependsOn(typeof(WorkflowRuntimeFeature))] |
| | | 23 | | [DependsOn(typeof(SasTokensFeature))] |
| | 1 | 24 | | public class WorkflowsApiFeature(IModule module) : FeatureBase(module) |
| | | 25 | | { |
| | | 26 | | /// <inheritdoc /> |
| | | 27 | | public override void Configure() |
| | | 28 | | { |
| | 1 | 29 | | Module.AddFastEndpointsAssembly(GetType()); |
| | 1 | 30 | | } |
| | | 31 | | |
| | | 32 | | /// <inheritdoc /> |
| | | 33 | | public override void Apply() |
| | | 34 | | { |
| | 1 | 35 | | Services.AddSerializationOptionsConfigurator<SerializationConfigurator>(); |
| | 1 | 36 | | Module.AddFastEndpointsFromModule(); |
| | | 37 | | |
| | 1 | 38 | | Services.AddScoped<IWorkflowDefinitionLinker, StaticWorkflowDefinitionLinker>(); |
| | 1 | 39 | | Services.AddScoped<IAuthorizationHandler, NotReadOnlyRequirementHandler>(); |
| | 1 | 40 | | Services.Configure<AuthorizationOptions>(options => |
| | 1 | 41 | | { |
| | 2 | 42 | | options.AddPolicy(AuthorizationPolicies.NotReadOnlyPolicy, policy => policy.AddRequirements(new NotReadOnlyR |
| | 2 | 43 | | }); |
| | 1 | 44 | | } |
| | | 45 | | } |