Repository navigation
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.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…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).
Owner
Author
|
Replaced by new PR rebased on latest master (feat/user-management-crud-v2) |
voidvec
added a commit
that referenced
this pull request
Aug 14, 2026
…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.
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.
Summary
A2 user-management补全 (全栈). Implements the highest-ROI IAM gap from next-phase-implementation-plan.md §A2.
Stacked on PR #49 (
feat/resource-scope-authorization-43) — the #43 scope infrastructure (EndpointInfo.requiredScopes + AuthorizationFilter scope gate) is a hard dependency for the new endpoints' authorization. Rebase tomasterafter #49 merges.Backend
Mapper::count+paginate().findBy. Query params:page,per_page(clamp 1-100),q(username/email LIKE),role(JOIN-free fan-out: Roles→UserRoles→userIds),locked(derived fromlocked_untilvs current time). Response:{page, per_page, total, total_pages, users}userrole + audit log (user_create). Returns 201 with created user JSON. Duplicate username →VALIDATION_USERNAME_TAKENusername,mfa_enabled,locked,org_id(wasemail+email_verifiedonly). Audit on success (user_update)userId/scope/clientIdonto request attributes (was only done by OAuth2AuthFilter). Enables admin handlers to identify the actor for audit loggingPOST /api/admin/userswith request schema; added query params on GET listFrontend
q), role/locked filter dropdowns, "Create User" modal (username/password/email/roles)Not in scope (Phase 2)
deleteUser (soft-delete) requires V024 migration + ORM model regen (
/orm-gen, user-only skill). Documented as the immediate next step.Verification
npm run build(tsc + vite) PASSnpm run test:unit(vitest) PASSDependencies on async/DB rules (
.claude/rules/db-operations.md)All new Mapper constructions (including nested ones in async callbacks) are wrapped in
try/catch→(*cb)(errorResult), making the new code more compliant than the pre-existing admin code.