From 8c8f5a7ffed342ff5cfac97541f7863d081760fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Schultz=20Madsen?= Date: Thu, 17 Sep 2026 10:19:51 +0200 Subject: [PATCH] feat(user): add EformUser.IsActive so a login can be disabled (#971) There is no account-state flag on EformUser today. Lockout exists but is only ever the automatic brute-force delay -- nothing sets it administratively -- so a known-good credential cannot be refused for policy reasons. That is what "this person resigned" needs: on one production tenant all four resigned workers still hold a working login, one of them seven weeks on. The "= true" initializer is load-bearing and is documented as such. The mapping (next step, in eform-angular-frontend-base) declares HasDefaultValue(true), which makes true this property's sentinel; EF Core omits a sentinel-valued column from the INSERT so the store default applies. Without the initializer a new EformUser holds false, EF Core writes it explicitly, and every account would be created disabled. Verified against EF Core 10.0.12, the version pinned here. Nothing reads the flag yet, so there is no behaviour to test in this commit; the test obligation lands with the login-refusal change that reads it. Part of microting/eform-angular-frontend#8072. Co-Authored-By: Claude Opus 5 --- .../Infrastructure/Database/Entities/EformUser.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eFormApi.BasePn/Infrastructure/Database/Entities/EformUser.cs b/eFormApi.BasePn/Infrastructure/Database/Entities/EformUser.cs index 489fc36..6f38799 100644 --- a/eFormApi.BasePn/Infrastructure/Database/Entities/EformUser.cs +++ b/eFormApi.BasePn/Infrastructure/Database/Entities/EformUser.cs @@ -37,4 +37,14 @@ public class EformUser : IdentityUser public string EmailSha256 { get; set; } public string ProfilePicture { get; set; } public string ProfilePictureSnapshot { get; set; } + /// + /// False blocks sign-in for this account, a resigned employee say. Not the same as + /// Identity's lockout, which is the automatic brute-force delay. + /// + // Keep the "= true". The mapping's HasDefaultValue(true) makes true this property's + // sentinel, and EF Core omits a sentinel-valued column from the INSERT so the store + // default applies. Without the initializer a new EformUser holds false, EF Core writes + // that explicitly, and every account would be created disabled. (That is precisely what + // happens to the shadow property ExternalLoginEnabled today, which cannot have one.) + public bool IsActive { get; set; } = true; } \ No newline at end of file