feat(user): add EformUser.IsActive so a login can be disabled (#971) - #972
Merged
Merged
Conversation
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 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The documentation claims inactive users cannot sign in, but this package does not enforce that behavior yet.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds EformUser.IsActive with an enabled-by-default initializer for future login disabling.
Changes:
- Adds the account activity flag and explanatory documentation.
- Preserves enabled defaults for newly created users.
File summaries
| File | Description |
|---|---|
eFormApi.BasePn/Infrastructure/Database/Entities/EformUser.cs |
Adds IsActive to EformUser. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+40
to
+43
| /// <summary> | ||
| /// 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. | ||
| /// </summary> |
This was referenced Sep 17, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #971. Step 1 of 4 — design: microting/eform-angular-frontend#8072, spec: microting/eform-angular-frontend#8073.
One property on
EformUser:Why
There is no account-state flag today.
LockoutEnabled/LockoutEndexist but are purely the automatic brute-force delay — nothing in the platform sets them administratively — so a known-good credential cannot be refused for policy reasons. Measured on one production tenant: all four resigned workers still hold a working login, one of them seven weeks after resigning.The
= trueis load-bearingThe mapping (step 2) declares
HasDefaultValue(true), which makestruethis property's sentinel; EF Core omits a sentinel-valued column from the INSERT so the store default applies. Without the initializer a freshly constructedEformUserholdsfalse, EF Core writes that explicitly, and every new account would be created disabled.Verified empirically against EF Core 10.0.12 (the version pinned in this repo) rather than from memory — an earlier draft of the comment had the direction backwards.
This trap is already sprung elsewhere:
ExternalLoginEnabledis a shadow bool withHasDefaultValue(true), and a shadow property cannot have an initializer — so every user created since20250904105541_AddOAuthLoginSupporthas it set to0despite the declared default. Dormant only because the property is dead code.No tests in this PR
Nothing reads the flag yet, so there is no behaviour to assert; this repo has no test project either. The test obligation lands with the login-refusal change that consumes it.
For whoever picks up step 2
Microting.EformAngularFrontendBase.csproj:14still pins BasePn 10.0.30 — bump it to this release ordotnet ef migrations addwill not seeIsActiveand will scaffold nothing.20250904105541_AddOAuthLoginSupport.cs:41-46:AddColumn<bool>(name: "IsActive", table: "Users", type: "tinyint(1)", nullable: false, defaultValue: true). A naively scaffoldeddefaultValue: falsewould disable every existing account on migrate.IdentityDbContextmaps the property by convention, and the host materialises wholeEformUserrows during boot (Startup.cs:502,Program.cs:263), so a package bump without the column stops the host from starting.🤖 Generated with Claude Code