mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
Org UI Improvements (#8436)
* feat(team_endpoints.py): support returning teams filtered by organization_id allows user to just get teams they belong to, within the org Enables org admin to see filtered list of teams on UI * fix(teams.tsx): simple filter for team on ui - just filter team based on selected org id * feat(ui/organizations): show 'default org' in switcher, filter teams based on selected org * feat(user_dashboard.tsx): update team in switcher when org changes * feat(schema.prisma): add new 'organization_id' value to key table allow org admin to directly issue keys to a user within their org * fix(view_key_table.tsx): fix regression where admin couldn't see keys caused by bad console log statement * fix(team_endpoints.py): handle default org value in /team/list * fix(key_management_endpoints.py): allow proxy admin to create keys for team they're not in * fix(team_endpoints.py): fix team endpoint to handle org id not being passed in * build(config.yml): investigate what pkg is installing posthog in ci/cd * ci(config.yml): uninstall posthog prevent it from being added in ci/cd * ci: auto-install ci
This commit is contained in:
parent
e26d7df91b
commit
13a3e8630e
15 changed files with 195 additions and 127 deletions
|
@ -39,6 +39,7 @@ from litellm.proxy._types import (
|
|||
NewTeamRequest,
|
||||
ProxyErrorTypes,
|
||||
ProxyException,
|
||||
SpecialManagementEndpointEnums,
|
||||
TeamAddMemberResponse,
|
||||
TeamInfoResponseObject,
|
||||
TeamListResponseObject,
|
||||
|
@ -1482,6 +1483,7 @@ async def list_team(
|
|||
user_id: Optional[str] = fastapi.Query(
|
||||
default=None, description="Only return teams which this 'user_id' belongs to"
|
||||
),
|
||||
organization_id: Optional[str] = None,
|
||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||
):
|
||||
"""
|
||||
|
@ -1492,6 +1494,7 @@ async def list_team(
|
|||
|
||||
Parameters:
|
||||
- user_id: str - Optional. If passed will only return teams that the user_id is a member of.
|
||||
- organization_id: str - Optional. If passed will only return teams that belong to the organization_id. Pass 'default_organization' to get all teams without organization_id.
|
||||
"""
|
||||
from litellm.proxy.proxy_server import prisma_client
|
||||
|
||||
|
@ -1565,6 +1568,19 @@ async def list_team(
|
|||
continue
|
||||
# Sort the responses by team_alias
|
||||
returned_responses.sort(key=lambda x: (getattr(x, "team_alias", "") or ""))
|
||||
|
||||
if organization_id is not None:
|
||||
if organization_id == SpecialManagementEndpointEnums.DEFAULT_ORGANIZATION.value:
|
||||
returned_responses = [
|
||||
team for team in returned_responses if team.organization_id is None
|
||||
]
|
||||
else:
|
||||
returned_responses = [
|
||||
team
|
||||
for team in returned_responses
|
||||
if team.organization_id == organization_id
|
||||
]
|
||||
|
||||
return returned_responses
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue