From 3f0438a59d0c594848c4063730a42bb712d9cee6 Mon Sep 17 00:00:00 2001 From: Krish Dholakia Date: Wed, 12 Feb 2025 22:51:54 -0800 Subject: [PATCH] UI Fixes p2 (#8502) * refactor(admin.tsx): cleanup add new admin flow removes buggy flow. Ensures just 1 simple way to add users / update roles. * fix(user_search_modal.tsx): ensure 'add member' button is always visible * fix(edit_membership.tsx): ensure 'save changes' button always visible * fix(internal_user_endpoints.py): ensure user in org can be deleted Fixes issue where user couldn't be deleted if they were a member of an org * fix: fix linting error --- .../internal_user_endpoints.py | 5 + .../src/components/admins.tsx | 111 +----------------- .../common_components/user_search_modal.tsx | 2 +- .../src/components/team/edit_membership.tsx | 2 +- 4 files changed, 8 insertions(+), 112 deletions(-) diff --git a/litellm/proxy/management_endpoints/internal_user_endpoints.py b/litellm/proxy/management_endpoints/internal_user_endpoints.py index 0f5bc46cc6..0d87519511 100644 --- a/litellm/proxy/management_endpoints/internal_user_endpoints.py +++ b/litellm/proxy/management_endpoints/internal_user_endpoints.py @@ -885,6 +885,11 @@ async def delete_user( where={"user_id": {"in": data.user_ids}} ) + ## DELETE ASSOCIATED ORGANIZATION MEMBERSHIPS + await prisma_client.db.litellm_organizationmembership.delete_many( + where={"user_id": {"in": data.user_ids}} + ) + ## DELETE USERS deleted_users = await prisma_client.db.litellm_usertable.delete_many( where={"user_id": {"in": data.user_ids}} diff --git a/ui/litellm-dashboard/src/components/admins.tsx b/ui/litellm-dashboard/src/components/admins.tsx index 32fd0f2865..d10c9bda42 100644 --- a/ui/litellm-dashboard/src/components/admins.tsx +++ b/ui/litellm-dashboard/src/components/admins.tsx @@ -496,116 +496,7 @@ const AdminPanel: React.FC = ({ return (
Admin Access - - {showSSOBanner && ( - - Requires SSO Setup - - )} -
- Proxy Admin: Can create keys, teams, users, add models, etc.{" "} -
- Proxy Admin Viewer: Can just view spend. They cannot create keys, - teams or grant users access to new models.{" "} -
- - - - - - - Member Name - Role - - - - - {admins - ? admins.map((member: any, index: number) => ( - - - {member["user_email"] - ? member["user_email"] - : member["user_id"] - ? member["user_id"] - : null} - - - {" "} - {possibleUIRoles?.[member?.user_role]?.ui_label || - "-"} - - - setIsUpdateModalModalVisible(true)} - /> - - {modifyMemberForm( - handleMemberUpdate, - member["user_role"], - member["user_id"] - )} - - - - )) - : null} - -
-
- - -
- - - {addMemberForm(handleAdminCreate)} - - - - - {addMemberForm(handleMemberCreate)} - -
- -
+ Go to 'Internal Users' page to add other admins. ✨ Security Settings diff --git a/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx b/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx index e31c038482..e415c04f2b 100644 --- a/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx +++ b/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx @@ -163,7 +163,7 @@ const UserSearchModal: React.FC = ({
-
diff --git a/ui/litellm-dashboard/src/components/team/edit_membership.tsx b/ui/litellm-dashboard/src/components/team/edit_membership.tsx index 2e22f2a5d6..3d1696916e 100644 --- a/ui/litellm-dashboard/src/components/team/edit_membership.tsx +++ b/ui/litellm-dashboard/src/components/team/edit_membership.tsx @@ -129,7 +129,7 @@ const TeamMemberModal: React.FC = ({ Cancel {mode === 'add' ? 'Add Member' : 'Save Changes'}