< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Shared.Messages.ScopePermissionMessageMap
Assembly: ArturRios.Heimdall.Shared
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Application/ArturRios.Heimdall.Shared/Messages/ScopePermissionMessageMap.cs
Line coverage
100%
Covered lines: 34
Uncovered lines: 0
Coverable lines: 34
Total lines: 48
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 1
Fully covered methods: 1
Total methods: 1
Method coverage: 100%
Full method coverage: 100%

Metrics

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

File(s)

/home/runner/work/heimdall-api/heimdall-api/src/Application/ArturRios.Heimdall.Shared/Messages/ScopePermissionMessageMap.cs

#LineLine coverage
 1using ArturRios.Util.Http;
 2
 3namespace ArturRios.Heimdall.Shared.Messages;
 4
 5/// <summary>
 6///     Maps each <see cref="ScopePermissionMessages" /> value to its HTTP status code, following the
 7///     UC-31 – UC-35 flows. Passed to the response resolver. The single <see cref="ScopePermissionMessages.NotScopeOwne
 8///     message covers the scope-ownership refusal for create, retrieve, update, and delete: a scope
 9///     permission has no owner of its own, so owning the scope is the only authorization there is.
 10///     UC-35's only refusals are the framework's: 403 from [RoleRequirement], 401 unauthenticated.
 11/// </summary>
 12public static class ScopePermissionMessageMap
 13{
 414    public static readonly IReadOnlyDictionary<string, int> StatusCodes =
 415        DataAccessMessageMap.CombinedWith(new Dictionary<string, int>
 416        {
 417            // UC-31 main flow — scope permission created.
 418            [ScopePermissionMessages.ScopePermissionCreatedSuccessfully] = HttpStatusCodes.Created,
 419            // AF-31a — scope not found.
 420            [ScopePermissionMessages.ScopeNotFound] = HttpStatusCodes.NotFound,
 421            // AF-31e / AF-32e / AF-33e / AF-34e — acting Scope Admin does not own the target scope.
 422            [ScopePermissionMessages.NotScopeOwner] = HttpStatusCodes.Forbidden,
 423            // AF-31d — invalid input.
 424            [ScopePermissionMessages.NameRequired] = HttpStatusCodes.BadRequest,
 425            [ScopePermissionMessages.NameTooLong] = HttpStatusCodes.BadRequest,
 426            [ScopePermissionMessages.DescriptionTooLong] = HttpStatusCodes.BadRequest,
 427            // UC-32 main flow — scope permission(s) retrieved.
 428            [ScopePermissionMessages.ScopePermissionRetrievedSuccessfully] = HttpStatusCodes.Ok,
 429            [ScopePermissionMessages.ScopePermissionsRetrievedSuccessfully] = HttpStatusCodes.Ok,
 430            // AF-32a — scope permission not found. The listing's own 404 reuses ScopeNotFound above.
 431            [ScopePermissionMessages.ScopePermissionNotFound] = HttpStatusCodes.NotFound,
 432            // UC-33 main flow — scope permission updated. AF-33a reuses ScopePermissionNotFound, and
 433            // UC-33's input validation reuses the UC-31 messages.
 434            [ScopePermissionMessages.ScopePermissionUpdatedSuccessfully] = HttpStatusCodes.Ok,
 435            // UC-34 main flow — scope permission logically deleted. AF-34b answers with the same 200, so
 436            // the response's AlreadyDeleted flag is what tells the two paths apart. AF-34a reuses
 437            // ScopePermissionNotFound, and AF-34e reuses NotScopeOwner.
 438            [ScopePermissionMessages.ScopePermissionDeletedSuccessfully] = HttpStatusCodes.Ok,
 439            // UC-35 main flow — scope permission hard deleted. AF-35a reuses ScopePermissionNotFound, and
 440            // UC-35's only other refusals are the framework's: 403 from [RoleRequirement], 401
 441            // unauthenticated.
 442            [ScopePermissionMessages.ScopePermissionHardDeletedSuccessfully] = HttpStatusCodes.Ok,
 443            // UC-32 read b (NFR-10) — invalid pagination or an over-length name filter.
 444            [PaginationMessages.InvalidPageNumber] = HttpStatusCodes.BadRequest,
 445            [PaginationMessages.InvalidPageSize] = HttpStatusCodes.BadRequest,
 446            [PaginationMessages.FilterTooLong] = HttpStatusCodes.BadRequest
 447        });
 48}

Methods/Properties

.cctor()