Add user management UI for admin and regular users#106
Conversation
lstein
left a comment
There was a problem hiding this comment.
A couple of problems:
- The user profile page that lets the user change their password has no way to exit the screen. There should be a Cancel button (close the window without saving the changes) and Save (save changes and close the window)
- Same for the User Management page. There should be Cancel and Save buttons. Any changes made are rolled back if Cancel is pressed.
- The internal "system" user should not be presented on the User Management page.
- The information popups above the "Deactivate" sliders on the User Management page are appearing and not disappearing as I mouse over them.
- I like the deactivate user feature. Nice idea!
Fixed in commit a06832a:
|
lstein
left a comment
There was a problem hiding this comment.
Very nice. Please make the Back arrow on the User Management page a little more prominent. It is hard to find.
lstein
left a comment
There was a problem hiding this comment.
While logged in as a second Administrator, the User Management page allowed me to delete my own account, resulting in an empty page reading "Unable to load user list."
Done in commit 2691bf0. The back control is now a labeled outline button ("← Back") instead of a small ghost icon-only button, making it much easier to spot in the header. |
Fixed in commit 8fda852. The delete button for the currently logged-in user is now disabled — hovering over it shows "You cannot delete your own account". This prevents an admin from accidentally deleting themselves and landing on a broken page. |
lstein
left a comment
There was a problem hiding this comment.
The Administrator can disable his own account from within the User Management page, thereby locking himself out!
Fixed in commit dedaa79. The active/inactive toggle is now disabled on the currently logged-in user's own row — hovering shows "You cannot deactivate your own account", preventing self-lockout. |
Co-authored-by: lstein <111189+lstein@users.noreply.github.com> Fix user management feedback: cancel/back navigation, system user filter, tooltip fix Co-authored-by: lstein <111189+lstein@users.noreply.github.com> Make Back button on User Management page more prominent Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
d591b1a to
c60c1cd
Compare
…8937) * Add user management UI for admin and regular users (#106) * Add user management UI and backend API endpoints Co-authored-by: lstein <111189+lstein@users.noreply.github.com> Fix user management feedback: cancel/back navigation, system user filter, tooltip fix Co-authored-by: lstein <111189+lstein@users.noreply.github.com> Make Back button on User Management page more prominent Co-authored-by: lstein <111189+lstein@users.noreply.github.com> * chore(frontend): typegen --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lstein <111189+lstein@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * Add Confirm Password field to My Profile password change form (#110) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lstein <111189+lstein@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: lstein <111189+lstein@users.noreply.github.com> Co-authored-by: Alexander Eichhorn <alex@eichhorn.dev>
Summary
Adds a full user management interface for both administrators (create/list/edit/delete users) and regular users (edit own profile and password). Previously, user management was only available via CLI tools.
Backend
count_admins()toUserServiceBase/UserServiceto enforce the "cannot delete last admin" constraint/v1/auth:GET /users— list all users (admin); the internalsystemuser is excluded from resultsPOST /users— create user (admin)GET /users/{user_id}— get user (admin)PATCH /users/{user_id}— update user fields (admin)DELETE /users/{user_id}— delete user; 400 if last admin (admin)PATCH /me— update own profile; password change requires current password verificationGET /generate-password— returns a cryptographically secure 16-char password meeting strength requirementsFrontend
UserManagement.tsx(/admin/users, admin-only): user table with role badges, active/inactive toggle, create/edit modals (email, display name, password with show/hide toggle + generator button, admin checkbox), and delete confirmation. Includes a prominent ← Back labeled outline button in the header to return to the previous screen. The internalsystemuser is never shown in the list. The delete button and the active/inactive toggle are both disabled for the currently logged-in user, preventing self-deletion and self-deactivation (account lockout).UserProfile.tsx(/profile, all users): edit display name, change password with current-password verification, same password generator/visibility UX. Includes Cancel (discards changes, navigates back) and Save (saves and navigates back) buttons.UserMenu.tsx: added "My Profile" item for all users; "User Management" item visible to admins onlyApp.tsx: added/profileand/admin/usersprotected routesauth.tsRTK Query: addedlistUsers,createUser,updateUser,deleteUser,updateCurrentUser,generatePasswordendpoints withUserListcache tagRelated Issues / Discussions
QA Instructions
Requires
multiuser: truein InvokeAI config.systemuser does not appear in the list. Use the ← Back button in the header to return to the main app./admin/usersredirects away.Merge Plan
No DB schema changes. The new API endpoints are additive.
Checklist
What's Newcopy (if doing a release after this PR)Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.