< Summary

Information
Class: Elsa.ExternalAuthentication.Services.ExternalAuthenticationUserDeletionDependencyContributor
Assembly: Elsa.ExternalAuthentication
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.ExternalAuthentication/Services/ExternalAuthenticationUserDeletionDependencyContributor.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 29
Line coverage: 100%
Branch coverage
75%
Covered branches: 3
Total branches: 4
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Source()100%11100%
InspectAsync()75%44100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.ExternalAuthentication/Services/ExternalAuthenticationUserDeletionDependencyContributor.cs

#LineLine coverage
 1using Elsa.ExternalAuthentication.Contracts;
 2using Elsa.ExternalAuthentication.Models;
 3using Elsa.Identity.Contracts;
 4using Elsa.Identity.Entities;
 5using Elsa.Identity.Models;
 6
 7namespace Elsa.ExternalAuthentication.Services;
 8
 9/// <summary>Prevents deleting users that still own external identity links.</summary>
 310public sealed class ExternalAuthenticationUserDeletionDependencyContributor(
 311    IExternalIdentityLinkManagementStore links) : IUserDeletionDependencyContributor
 12{
 13    public const string SourceName = "external-authentication";
 214    public string Source => SourceName;
 15
 16    /// <inheritdoc />
 17    public async ValueTask<UserDeletionDependency?> InspectAsync(User user, CancellationToken cancellationToken = defaul
 18    {
 519        var linksForUser = await links.FindAsync(new ExternalIdentityLinkFilter
 520        {
 521            TenantId = user.TenantId ?? string.Empty,
 522            UserId = user.Id
 523        }, cancellationToken);
 24
 525        return linksForUser.Items.Count == 0
 526            ? null
 527            : new UserDeletionDependency(Source, "The user is referenced by one or more external identity links.");
 528    }
 29}