feat: Add user management and self-service password change#39
Merged
Conversation
Add admin-only user management (CRUD, activate/deactivate, password reset) and self-service password change for all authenticated users. Backend: - UserViewSet with per-action permissions (IsAdminUser for management, IsAuthenticated for password change) - DenyApiKeyAccess permission to block API key auth on user endpoints - Service layer for user lifecycle operations - Admin users can view all projects/resources (OwnedResourceMixin bypass) - is_staff exposed on /auth/user/ endpoint Frontend: - UserManagementPage with DataTable, create/deactivate/reset dialogs - PasswordChangePage for self-service password change - Admin-only sidebar section with route guard - Async router guard to handle page reload (fetches user before check) - i18n support (en/ja) Tests: 14 test cases covering permissions, CRUD, API key blocking, and admin project visibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Add admin-only user management (CRUD, activate/deactivate, password reset) and self-service password change for all authenticated users, with full frontend UI and i18n support.
Changes Made
Backend (11 files)
IsAdminUserfor management,IsAuthenticatedfor self-service password changeread/writescopes cannot access these endpoints)user_service.py) — Business logic for create, activate, deactivate, and password resetserializers/user.py) — 5 serializers for list, create, update, admin password reset, and self password change with Django password validationOwnedResourceMixin/CreatedByResourceMixinbypass foris_staffusers, allowing admins to view all projects and resourcesis_staffon auth endpoint — Exposed on/auth/user/so frontend can determine admin statusFrontend (8 files)
requiresAdminmeta, preventing redirect on page reloadis_staffusersTests (1 file, 14 cases)
read/writescopes)Testing
Breaking Changes
None — additive changes only. Existing endpoints and behavior are unchanged.
Additional Notes
is_staff,is_active,date_joined,last_login)pagination_class = Noneon UserViewSet since this is an admin-only endpoint with limited usersis_active=False) is used instead of hard delete