< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Domain.Entities.Scope
Assembly: ArturRios.Heimdall.Domain
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Domain/ArturRios.Heimdall.Domain/Entities/Scope.cs
Line coverage
100%
Covered lines: 17
Uncovered lines: 0
Coverable lines: 17
Total lines: 109
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 17
Fully covered methods: 17
Total methods: 17
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_PublicId()100%11100%
get_Name()100%11100%
get_Description()100%11100%
get_IsDeleted()100%11100%
get_GoogleSignInEnabled()100%11100%
get_SelfRegistrationEnabled()100%11100%
get_DefaultLegalBasis()100%11100%
get_PrivacyNoticeUri()100%11100%
get_EmailVerificationUrl()100%11100%
get_PasswordResetUrl()100%11100%
get_CreatedAt()100%11100%
get_UpdatedAt()100%11100%
get_Owners()100%11100%
get_Users()100%11100%
get_Applications()100%11100%
get_GoogleUsers()100%11100%
get_ScopePermissions()100%11100%

File(s)

/home/runner/work/heimdall-api/heimdall-api/src/Domain/ArturRios.Heimdall.Domain/Entities/Scope.cs

#LineLine coverage
 1using System.ComponentModel.DataAnnotations;
 2using ArturRios.Data.Relational.Core.Entities;
 3
 4namespace ArturRios.Heimdall.Domain.Entities;
 5
 6/// <summary>
 7///     A logical tenant boundary that groups the owners, users, applications, and Google Users
 8///     belonging to a specific client system.
 9/// </summary>
 10public class Scope : Entity<long>
 11{
 12    /// <summary>
 13    ///     External identifier, generated on creation and used everywhere the scope is addressed
 14    ///     from outside the database (API paths, response bodies, token claims). The internal
 15    ///     <see cref="Entity{TKey}.Id" /> is never exposed to callers.
 16    /// </summary>
 494617    public Guid PublicId { get; set; } = Guid.NewGuid();
 18
 19    /// <summary>Scope display name. Required, unique.</summary>
 20    [MaxLength(200)]
 313121    public string Name { get; set; } = string.Empty;
 22
 23    /// <summary>Optional description of the scope's purpose.</summary>
 24    [MaxLength(500)]
 17925    public string? Description { get; set; }
 26
 27    /// <summary>Logical deletion flag. Logically deleted scopes are excluded from default queries.</summary>
 118728    public bool IsDeleted { get; set; }
 29
 30    /// <summary>
 31    ///     Whether Google sign-up/sign-in is available for this scope. Defaults to <c>false</c>;
 32    ///     only the scope's owners or a System Admin may toggle it.
 33    /// </summary>
 27834    public bool GoogleSignInEnabled { get; set; }
 35
 36    /// <summary>
 37    ///     Whether anonymous callers may register a password <c>User</c> in this scope (UC-47,
 38    ///     FR-SR-01). Defaults to <c>false</c>; only the scope's owners or a System Admin may toggle it.
 39    /// </summary>
 30340    public bool SelfRegistrationEnabled { get; set; }
 41
 42    /// <summary>
 43    ///     The lawful basis this tenant processes its users' data on (see <c>LegalBases</c>), or
 44    ///     <c>null</c> to take the deployment default of contract performance.
 45    /// </summary>
 46    /// <remarks>
 47    ///     The scope is where this belongs because the scope is the tenant boundary, and in most
 48    ///     deployments the tenant organisation is the controller for the identities inside it (Data
 49    ///     Protection Document §3). One deployment-wide basis would assert something about every
 50    ///     tenant that only each tenant can know.
 51    /// </remarks>
 15252    public int? DefaultLegalBasis { get; set; }
 53
 54    /// <summary>
 55    ///     Where this tenant's own privacy notice is published, or <c>null</c> if it has none
 56    ///     distinct from Heimdall's.
 57    /// </summary>
 58    /// <remarks>
 59    ///     GDPR Art. 13 and LGPD Art. 9 oblige the controller to inform the data subject, and for a
 60    ///     scope's users that controller is the tenant. Carrying the URI here lets a client system
 61    ///     show the right notice at sign-up without hard-coding it.
 62    /// </remarks>
 63    [MaxLength(2048)]
 9664    public string? PrivacyNoticeUri { get; set; }
 65
 66    /// <summary>
 67    ///     Base link the verification token is appended to in the emails sent to this scope's
 68    ///     <c>User</c>s (sign-up confirmation and address verification), or <c>null</c> to use the
 69    ///     deployment-wide <c>HEIMDALL_EMAIL_VERIFICATION_URL</c>.
 70    /// </summary>
 71    /// <remarks>
 72    ///     A client system has its own screens for these steps, and its users' links must lead
 73    ///     there rather than to Heimdall's. Administrators have no scope and always take the global
 74    ///     link.
 75    /// </remarks>
 76    [MaxLength(2048)]
 20077    public string? EmailVerificationUrl { get; set; }
 78
 79    /// <summary>
 80    ///     Base link the reset token is appended to in the password-reset emails sent to this scope's
 81    ///     <c>User</c>s, or <c>null</c> to use the deployment-wide <c>HEIMDALL_PASSWORD_RESET_URL</c>.
 82    ///     Administrators have no scope and always take the global link.
 83    /// </summary>
 84    [MaxLength(2048)]
 14985    public string? PasswordResetUrl { get; set; }
 86
 87    /// <summary>Creation timestamp.</summary>
 12188    public DateTime CreatedAt { get; set; }
 89
 90    /// <summary>Last update timestamp.</summary>
 15491    public DateTime UpdatedAt { get; set; }
 92
 93    // Navigation properties
 94
 95    /// <summary>Ownership join rows linking this scope to its owners (persons with the <c>ScopeAdmin</c> role).</summar
 184096    public ICollection<ScopeOwner> Owners { get; set; } = new List<ScopeOwner>();
 97
 98    /// <summary>Membership join rows linking this scope to its users (persons with the <c>User</c> role).</summary>
 173299    public ICollection<ScopeUser> Users { get; set; } = new List<ScopeUser>();
 100
 101    /// <summary>Applications contained in this scope.</summary>
 1715102    public ICollection<Application> Applications { get; set; } = new List<Application>();
 103
 104    /// <summary>Google Users contained in this scope.</summary>
 1715105    public ICollection<GoogleUser> GoogleUsers { get; set; } = new List<GoogleUser>();
 106
 107    /// <summary>Scope-specific permissions defined within this scope.</summary>
 1715108    public ICollection<ScopePermission> ScopePermissions { get; set; } = new List<ScopePermission>();
 109}