< Summary

Information
Class: Elsa.Abstractions.ElsaEndpoint<T1, T2>
Assembly: Elsa.Api.Common
File(s): /home/runner/work/elsa-core/elsa-core/src/common/Elsa.Api.Common/Abstractions/Endpoints.cs
Line coverage
75%
Covered lines: 3
Uncovered lines: 1
Coverable lines: 4
Total lines: 72
Line coverage: 75%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ConfigurePermissions(...)50%2275%

File(s)

/home/runner/work/elsa-core/elsa-core/src/common/Elsa.Api.Common/Abstractions/Endpoints.cs

#LineLine coverage
 1using FastEndpoints;
 2
 3namespace Elsa.Abstractions;
 4
 5/// <summary>
 6/// An endpoint that maps a request to a response.
 7/// </summary>
 8public 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
 19public 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
 30public 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
 41public class ElsaEndpoint<TRequest, TResponse> : Endpoint<TRequest, TResponse> where TRequest : notnull, new() where TRe
 42{
 43    protected void ConfigurePermissions(params string[] permissions)
 44    {
 3345        if (!EndpointSecurityOptions.SecurityIsEnabled)
 046            AllowAnonymous();
 47        else
 3348            Permissions(new[] { PermissionNames.All }.Concat(permissions).ToArray());
 3349    }
 50}
 51
 52public class ElsaEndpoint<TRequest, TResponse, TMapper> : Endpoint<TRequest, TResponse, TMapper> where TRequest : notnul
 53{
 54    protected void ConfigurePermissions(params string[] permissions)
 55    {
 56        if (!EndpointSecurityOptions.SecurityIsEnabled)
 57            AllowAnonymous();
 58        else
 59            Permissions(new[] { PermissionNames.All }.Concat(permissions).ToArray());
 60    }
 61}
 62
 63public 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}