| | | 1 | | using FastEndpoints; |
| | | 2 | | |
| | | 3 | | namespace Elsa.Abstractions; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// An endpoint that maps a request to a response. |
| | | 7 | | /// </summary> |
| | | 8 | | public abstract class ElsaEndpointWithMapper<TRequest, TMapper> : EndpointWithMapper<TRequest, TMapper> where TMapper : |
| | | 9 | | { |
| | | 10 | | protected void ConfigurePermissions(params string[] permissions) |
| | | 11 | | { |
| | | 12 | | if (!EndpointSecurityOptions.SecurityIsEnabled) |
| | | 13 | | AllowAnonymous(); |
| | | 14 | | else |
| | | 15 | | Permissions(new[] { PermissionNames.All }.Concat(permissions).ToArray()); |
| | | 16 | | } |
| | | 17 | | } |
| | | 18 | | |
| | | 19 | | public abstract class ElsaEndpointWithoutRequest : EndpointWithoutRequest |
| | | 20 | | { |
| | | 21 | | protected void ConfigurePermissions(params string[] permissions) |
| | | 22 | | { |
| | | 23 | | if (!EndpointSecurityOptions.SecurityIsEnabled) |
| | | 24 | | AllowAnonymous(); |
| | | 25 | | else |
| | | 26 | | Permissions(new[] { PermissionNames.All }.Concat(permissions).ToArray()); |
| | | 27 | | } |
| | | 28 | | } |
| | | 29 | | |
| | | 30 | | public abstract class ElsaEndpointWithoutRequest<TResponse> : EndpointWithoutRequest<TResponse> where TResponse : notnul |
| | | 31 | | { |
| | | 32 | | protected void ConfigurePermissions(params string[] permissions) |
| | | 33 | | { |
| | | 34 | | if (!EndpointSecurityOptions.SecurityIsEnabled) |
| | | 35 | | AllowAnonymous(); |
| | | 36 | | else |
| | | 37 | | Permissions(new[] { PermissionNames.All }.Concat(permissions).ToArray()); |
| | | 38 | | } |
| | | 39 | | } |
| | | 40 | | |
| | | 41 | | public class ElsaEndpoint<TRequest, TResponse> : Endpoint<TRequest, TResponse> where TRequest : notnull, new() where TRe |
| | | 42 | | { |
| | | 43 | | protected void ConfigurePermissions(params string[] permissions) |
| | | 44 | | { |
| | | 45 | | if (!EndpointSecurityOptions.SecurityIsEnabled) |
| | | 46 | | AllowAnonymous(); |
| | | 47 | | else |
| | | 48 | | Permissions(new[] { PermissionNames.All }.Concat(permissions).ToArray()); |
| | | 49 | | } |
| | | 50 | | } |
| | | 51 | | |
| | | 52 | | public class ElsaEndpoint<TRequest, TResponse, TMapper> : Endpoint<TRequest, TResponse, TMapper> where TRequest : notnul |
| | | 53 | | { |
| | | 54 | | protected void ConfigurePermissions(params string[] permissions) |
| | | 55 | | { |
| | 1 | 56 | | if (!EndpointSecurityOptions.SecurityIsEnabled) |
| | 0 | 57 | | AllowAnonymous(); |
| | | 58 | | else |
| | 1 | 59 | | Permissions(new[] { PermissionNames.All }.Concat(permissions).ToArray()); |
| | 1 | 60 | | } |
| | | 61 | | } |
| | | 62 | | |
| | | 63 | | public class ElsaEndpoint<TRequest> : Endpoint<TRequest> where TRequest : notnull, new() |
| | | 64 | | { |
| | | 65 | | protected void ConfigurePermissions(params string[] permissions) |
| | | 66 | | { |
| | | 67 | | if (!EndpointSecurityOptions.SecurityIsEnabled) |
| | | 68 | | AllowAnonymous(); |
| | | 69 | | else |
| | | 70 | | Permissions(new[] { PermissionNames.All }.Concat(permissions).ToArray()); |
| | | 71 | | } |
| | | 72 | | } |