< Summary

Information
Class: Elsa.Authorization.CoreVerbs
Assembly: Elsa.Api.Common
File(s): /home/runner/work/elsa-core/elsa-core/src/common/Elsa.Api.Common/Authorization/CoreVerbs.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 40
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_All()100%11100%
IsCore(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/common/Elsa.Api.Common/Authorization/CoreVerbs.cs

#LineLine coverage
 1namespace Elsa.Authorization;
 2
 3/// <summary>
 4/// The recommended core verbs. Modules SHOULD reuse these wherever the meaning fits, so that a role
 5/// editor reads consistently across resources. They are a convention, not a closed set: a module that
 6/// needs a verb outside this list declares it, and the catalog marks it as non-core so a reviewer can
 7/// spot a needless synonym.
 8/// </summary>
 9/// <remarks>
 10/// A resource declares either <see cref="Create"/> + <see cref="Update"/>, or <see cref="Write"/> —
 11/// never both. Which one depends on whether the module's API separates the operations. Never-both is
 12/// what stops <see cref="Write"/> acting as an aggregate: within any one resource there is no ambiguity
 13/// about which verb an endpoint requires, so no verb needs to imply another.
 14/// </remarks>
 15public static class CoreVerbs
 16{
 17    /// <summary>Read, list, query, inspect, export.</summary>
 18    public const string View = "view";
 19
 20    /// <summary>Bring a new record into existence.</summary>
 21    public const string Create = "create";
 22
 23    /// <summary>Modify an existing record.</summary>
 24    public const string Update = "update";
 25
 26    /// <summary>Create or modify, where the API does not separate the two.</summary>
 27    public const string Write = "write";
 28
 29    /// <summary>Remove a record.</summary>
 30    public const string Delete = "delete";
 31
 32    /// <summary>Run, dispatch, or invoke against a live system.</summary>
 33    public const string Execute = "execute";
 34
 35    /// <summary>The recommended core set, in declaration order.</summary>
 17536    public static IReadOnlyList<string> All { get; } = [View, Create, Update, Write, Delete, Execute];
 37
 38    /// <summary>Whether <paramref name="verb"/> belongs to the recommended core set.</summary>
 17339    public static bool IsCore(string verb) => All.Contains(verb, StringComparer.Ordinal);
 40}

Methods/Properties

get_All()
IsCore(System.String)