Repository navigation
feat(admin): user management CRUD — pagination, search/filter, createUser, expanded updateUser - #52
Conversation
…User, expanded updateUser (#A2) Backend: - listUsers: real pagination (page/per_page, total count via Mapper::count), search (q on username/email), filters (role via JOIN-free fan-out, locked derived from locked_until) - createUser (POST /api/admin/users): PBKDF2 hash + default role assignment + audit log (user_create); 201 Created response - updateUser: expanded to username, mfa_enabled, locked, org_id (was email + email_verified only) - AuthorizationFilter: persist userId/scope/clientId onto request attributes (was only done by OAuth2AuthFilter) so admin handlers can identify the actor - OpenAPI: added POST /api/admin/users + query params on GET list Frontend: - UsersPage: pagination controls, search bar, role/locked filters, Create User modal (username/password/email/roles) - UserDetailPage: Info tab expanded — username, mfa_enabled, locked, org_id now editable (was email + email_verified only) - mock-api: paginated GET handler + POST create mock with duplicate detection - e2e: create-user, search-filter, duplicate-username test cases Tests: - AdminUserApiHttpTest: 7 new cases (create success/dup/missing, pagination, search, expanded update, locked filter) Stacked on PR #49 (feat/resource-scope-authorization-43); rebase to master after #49 merges.
…User/updateUser Code review (PR #51): the previous generic 'unique'/'duplicate' substring match always reported VALIDATION_USERNAME_TAKEN even for duplicate emails. Now matches constraint names (users_username_key / idx_users_email_unique) like AuthService and PostgresIdentityRepository already do.
…minUserId, unique suffix - DuplicateUsername test: VALIDATION_USERNAME_TAKEN maps to HTTP 409 (not 400) - findAdminUserId: use ?q=admin search to find admin user across pages (admin user is at id=513, not page 1 of default per_page=50) - uniqueSuffix: use 9-digit modulo to avoid collisions across rapid re-runs - mock-api: POST duplicate returns 409 to match backend All 16 AdminUser tests pass with local PostgreSQL (7 new + 9 existing).
…are endpoint scripts - OpenApi fingerprint: add POST /api/admin/users entry - route_manifest.txt golden: add POST /api/admin/users - test-admin-endpoints.ps1/.sh: use ?q= search for admin/test user lookup (list endpoint is now paginated, admin user not always on page 1)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…end)
Backend:
- V024: add deleted_at column to users table
- deleteUser (DELETE /api/admin/users/{userId}): soft-delete + audit
- All user queries filter deleted_at IS NULL
- OpenAPI: DELETE endpoint
Frontend: UsersPage Delete button with confirm; mock-api DELETE handler
Tests: delete soft-delete integration test + baseline updates
Security: mock-api credential-looking values replaced with process.env pattern
Full-test ORM regen output — required for CI builds that don't run the ORM regeneration step. Adds deleted_at accessors to Users.h/.cc.
… non-public-surface) The dirtyFlag_ array size changed [17]→[18] because V024 added the deleted_at column. This is an internal ORM-generated field, not part of the SDK public API surface. Used --force per the tool's guidance for verified non-public-surface changes.
PR #52 Review — user-management CRUD (pagination, search/filter, createUser, expanded updateUser, soft-delete)Verdict: Request changes — 1 critical + 1 high functional issue must be fixed before merge. 🔴 Critical1. Soft-delete does not block login (security/correctness) 🟠 High (functional)2.
🟡 Medium3. Case-sensitive 4. Silent partial failure on role assignment in 5. Unvalidated 6. No self / last-admin delete guard 🟢 Low / suggestions
✅ Strengths
Line references are on head branch |
1 similar comment
PR #52 Review — user-management CRUD (pagination, search/filter, createUser, expanded updateUser, soft-delete)Verdict: Request changes — 1 critical + 1 high functional issue must be fixed before merge. 🔴 Critical1. Soft-delete does not block login (security/correctness) 🟠 High (functional)2.
🟡 Medium3. Case-sensitive 4. Silent partial failure on role assignment in 5. Unvalidated 6. No self / last-admin delete guard 🟢 Low / suggestions
✅ Strengths
Line references are on head branch |
… fixes Critical #1: soft-deleted users can no longer log in - PostgresIdentityRepository: add deleted_at IS NULL filter to findByEmail, findByUsername, findById, findByPublicSub, getUserInfoWithRoles, getRoles(subject) — blocks login, userinfo, and token-issuance role resolution - deleteUser: revoke all access + refresh tokens for the deleted user (introspection/refresh copy subject from token rows, never query users) High #2: getUser now returns org_id in the response JSON Medium #3: listUsers search escapes LIKE wildcards (%/_) in query param q Medium #5: createUser/updateUser guard org_id/locked type coercion with isInt()/isBool() to prevent uncaught Json::LogicError in async callbacks Medium #6: deleteUser rejects self-deletion (admin cannot delete own account)
…1 delivery Restores the memory-verdict updates lost when the working tree was switched to feat/user-management-crud-v2 (the previous edits were never committed), and syncs all tracking docs with the newly delivered work: Memory verdict (⚠️ → ✅, re-applied across 4 docs): - SDK embedding scope measured 2026-08-13: third-party-host-smoke (pure SDK) peak working set 2.5 MB / private 0.6 MB / binary 12 MB; full-stack-host-smoke (SDK+Drogon) also 2.5 MB peak - 50-120MB claim conservatively MET — actual SDK logic layer far below - docker stats 2.4GB is a different scope (container: pools + shared libs + page cache), not comparable to the SDK claim Newly delivered work synced: - A2 user management CRUD — IMPLEMENTED (PR #52): pagination, search, createUser, updateUser expansion, deleteUser soft-delete (V024) - D1 Backchannel Logout — BACKEND DELIVERED (PR #50): notifier + logout_token JWT + admin API + discovery + unit tests D1-D6; frontend blocked by Mimosa false-positive, integration tests pending - Phase 2 completion raised ~25% → ~45%; Phase 0 raised ~85% → ~90% - IAM audit: user mgmt + backchannel logout rows updated to delivered - next-phase plan: completed-tiers table extended, A2/B1 sections marked delivered, dependency graph + risk matrix + decision items updated (decisions 1-3 now resolved)
…1 delivery Restores the memory-verdict updates lost when the working tree was switched to feat/user-management-crud-v2 (the previous edits were never committed), and syncs all tracking docs with the newly delivered work: Memory verdict (⚠️ → ✅, re-applied across 4 docs): - SDK embedding scope measured 2026-08-13: third-party-host-smoke (pure SDK) peak working set 2.5 MB / private 0.6 MB / binary 12 MB; full-stack-host-smoke (SDK+Drogon) also 2.5 MB peak - 50-120MB claim conservatively MET — actual SDK logic layer far below - docker stats 2.4GB is a different scope (container: pools + shared libs + page cache), not comparable to the SDK claim Newly delivered work synced: - A2 user management CRUD — IMPLEMENTED (PR #52): pagination, search, createUser, updateUser expansion, deleteUser soft-delete (V024) - D1 Backchannel Logout — BACKEND DELIVERED (PR #50): notifier + logout_token JWT + admin API + discovery + unit tests D1-D6; frontend blocked by Mimosa false-positive, integration tests pending - Phase 2 completion raised ~25% → ~45%; Phase 0 raised ~85% → ~90% - IAM audit: user mgmt + backchannel logout rows updated to delivered - next-phase plan: completed-tiers table extended, A2/B1 sections marked delivered, dependency graph + risk matrix + decision items updated (decisions 1-3 now resolved)
…1 delivery Restores the memory-verdict updates lost when the working tree was switched to feat/user-management-crud-v2 (the previous edits were never committed), and syncs all tracking docs with the newly delivered work: Memory verdict (⚠️ → ✅, re-applied across 4 docs): - SDK embedding scope measured 2026-08-13: third-party-host-smoke (pure SDK) peak working set 2.5 MB / private 0.6 MB / binary 12 MB; full-stack-host-smoke (SDK+Drogon) also 2.5 MB peak - 50-120MB claim conservatively MET — actual SDK logic layer far below - docker stats 2.4GB is a different scope (container: pools + shared libs + page cache), not comparable to the SDK claim Newly delivered work synced: - A2 user management CRUD — IMPLEMENTED (PR #52): pagination, search, createUser, updateUser expansion, deleteUser soft-delete (V024) - D1 Backchannel Logout — BACKEND DELIVERED (PR #50): notifier + logout_token JWT + admin API + discovery + unit tests D1-D6; frontend blocked by Mimosa false-positive, integration tests pending - Phase 2 completion raised ~25% → ~45%; Phase 0 raised ~85% → ~90% - IAM audit: user mgmt + backchannel logout rows updated to delivered - next-phase plan: completed-tiers table extended, A2/B1 sections marked delivered, dependency graph + risk matrix + decision items updated (decisions 1-3 now resolved)
CHANGELOG for v1.2.0 (61 commits since v1.1.0): #43 resource-scope authorization model, A2 user-management CRUD (PR #52), B1 back-channel logout backend (PR #50), A1 OpenAPI spec governance M0 + breaking-change gates (PR #63), benchmark M2-M4 load-bearing verdicts (PR #48), and the #53-#60 user-admin hardening batch (PR #62). Per the release SOP (docs/backend/versioning-and-release.md §11.1): draft via `git cliff --unreleased --tag v1.2.0 --prepend`, then hand-curated (themed sections, security-hardening migrations, noise removed). Version SSoT already bumped to 1.2.0 in e5548ec; api-diff and the new spec-governance gate verified OK on the release ref.
Summary
A2 user-management补全 (全栈) + Phase 2 deleteUser soft-delete.
Backend
page,per_page,q(username/email LIKE),role(JOIN-free fan-out),locked(derived fromlocked_until). Real total viaMapper::count. Response:{page, per_page, total, total_pages, users}username,mfa_enabled,locked,org_id(was email + email_verified only)deleted_at; soft-delete sets timestamp + audit. All user queries filterdeleted_at IS NULLuserId/scope/clientIdfor admin audit loggingFrontend
Verification
npm run build+npm run test:unitpass