From cd3b2a21c1a575e30db1e802c762002835539b92 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 22 Apr 2024 14:15:09 -0700 Subject: [PATCH 1/2] ui - find all teams --- litellm/proxy/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index e5051590acd..19b9a0a60f4 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -1190,6 +1190,8 @@ class PrismaClient: response = await self.db.litellm_teamtable.find_many( where={"team_id": {"in": team_id_list}} ) + elif query_type == "find_all" and team_id_list is None: + response = await self.db.litellm_teamtable.find_many(take=20) return response elif table_name == "user_notification": if query_type == "find_unique": From 50bbd188fb3d0c8dd401360de6be0140a754587e Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 22 Apr 2024 14:15:50 -0700 Subject: [PATCH 2/2] ui - show all teams on ui --- litellm/proxy/proxy_server.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index ffb5ddfeba8..171ab6e6479 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -5911,11 +5911,18 @@ async def user_info( user_id=user_api_key_dict.user_id ) # *NEW* get all teams in user 'teams' field - teams_2 = await prisma_client.get_data( - team_id_list=caller_user_info.teams, - table_name="team", - query_type="find_all", - ) + if getattr(caller_user_info, "user_role", None) == "proxy_admin": + teams_2 = await prisma_client.get_data( + table_name="team", + query_type="find_all", + team_id_list=None, + ) + else: + teams_2 = await prisma_client.get_data( + team_id_list=caller_user_info.teams, + table_name="team", + query_type="find_all", + ) if teams_2 is not None and isinstance(teams_2, list): for team in teams_2: