< Summary

Information
Class: Elsa.Identity.Endpoints.Roles.Delete.RoleDeletionDependencyResponse
Assembly: Elsa.Identity
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Identity/Endpoints/Roles/Delete/Models.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 18
Coverable lines: 18
Total lines: 61
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
get_Source()100%210%
get_OwnerId()100%210%
get_OwnerKey()100%210%
get_PolicyBranch()100%210%
get_Ownership()100%210%
get_ConfigurationPath()100%210%
get_Revision()100%210%
get_RemovesLastDefaultRole()100%210%
From(...)0%620%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Identity/Endpoints/Roles/Delete/Models.cs

#LineLine coverage
 1using Elsa.Identity.Models;
 2
 3namespace Elsa.Identity.Endpoints.Roles.Delete;
 4
 5internal sealed class RemediateRoleDeletionRequest
 6{
 7    public string? ExpectedDependencyVersion { get; set; }
 8    public bool ConfirmRemoveFromEditableJitPolicies { get; set; }
 9    public bool ConfirmEmptyDefaultRoles { get; set; }
 10    public bool ConfirmBestEffort { get; set; }
 11    public IReadOnlyCollection<RoleDeletionReferenceSelection>? SelectedReferences { get; set; }
 12    public string? ReplacementRoleId { get; set; }
 13}
 14
 15internal sealed record RoleDeletionErrorResponse(string Error, string Message, object? Details = null);
 16
 17internal sealed record RoleDeletionImpactResponse(
 18    string RoleId,
 19    string DependencyVersion,
 20    string ExecutionMode,
 21    bool CanDelete,
 22    bool CanRemediate,
 23    IReadOnlyCollection<RoleDeletionDependencyResponse> ConfigurationReferences,
 24    IReadOnlyCollection<RoleDeletionDependencyResponse> EditableReferences,
 25    IReadOnlyCollection<string> Warnings)
 26{
 27    public static RoleDeletionImpactResponse From(RoleDeletionImpact impact)
 28    {
 29        var references = impact.Dependencies.Select(RoleDeletionDependencyResponse.From).ToArray();
 30        return new RoleDeletionImpactResponse(
 31            impact.RoleId,
 32            impact.DependencyVersion,
 33            impact.ExecutionMode == RoleDeletionExecutionMode.Atomic ? "atomic" : "bestEffort",
 34            impact.CanDelete,
 35            impact.CanRemediate,
 36            references.Where(x => x.Ownership == "configuration").ToArray(),
 37            references.Where(x => x.Ownership == "database").ToArray(),
 38            impact.Dependencies.Any(x => x.RemovesLastDefaultRole) ? ["removes_last_default_role"] : []);
 39    }
 40}
 41
 042internal sealed record RoleDeletionDependencyResponse(
 043    string Source,
 044    string OwnerId,
 045    string OwnerKey,
 046    string PolicyBranch,
 047    string Ownership,
 048    string? ConfigurationPath,
 049    long? Revision,
 050    bool RemovesLastDefaultRole)
 51{
 052    public static RoleDeletionDependencyResponse From(RoleDeletionDependency dependency) => new(
 053        dependency.Source,
 054        dependency.OwnerId,
 055        dependency.OwnerKey,
 056        dependency.PolicyBranch,
 057        dependency.Ownership == RoleDeletionDependencyOwnership.Configuration ? "configuration" : "database",
 058        dependency.ConfigurationPath,
 059        dependency.ExpectedRevision,
 060        dependency.RemovesLastDefaultRole);
 61}