feat: Admin account management#104
Merged
Merged
Conversation
The admin area under /admin/users (already gated to ROLE_ADMIN) lists every account with roles and status, creates INSTRUCTOR accounts, and archives or reactivates any account. RegistrationService gains a role-parameterized overload so instructor creation reuses the exact uniqueness, hashing, and race-safe constraint mapping of self-registration; the admin sets the initial password and hands it over out of band, and the instructor can change it through the existing password-reset flow (recorded in the service Javadoc). Archiving sets is_active = false, which the login already maps to a disabled account; an admin cannot archive their own account (409), so the platform cannot lose its last admin. Account creation, archiving, and reactivation are audited. The security matrix tightens the admin gate to 200.
The moderation view at /admin/courses lists every course, whatever its status or instructor, with its lessons. Archive and restore reuse the Phase 3 lifecycle methods (same transition guards, same audit trail) while bypassing only the ownership rule: the admin loads content directly instead of going through the instructor-owned lookup. AdminFlowTest drives both admin journeys end to end: the created instructor account really unlocks the instructor area through its DB role, an archived account can no longer log in and a reactivated one can again, self-archiving answers 409, moderation archives and restores the course of another instructor, and the ADMIN role does not leak into the instructor area.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #104 +/- ##
============================================
+ Coverage 79.22% 79.65% +0.42%
- Complexity 157 177 +20
============================================
Files 35 37 +2
Lines 669 747 +78
Branches 38 41 +3
============================================
+ Hits 530 595 +65
- Misses 109 123 +14
+ Partials 30 29 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
This is part 1 of 2 in a stack made with GitButler: