mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
fix(internal_user_endpoints.py): delete associated invitation links before deleting user in /user/delete
Fixes https://github.com/BerriAI/litellm/issues/4740
This commit is contained in:
parent
a6e850f0cd
commit
b73c5f1a8f
2 changed files with 8 additions and 1 deletions
|
@ -778,6 +778,11 @@ async def delete_user(
|
||||||
where={"user_id": {"in": data.user_ids}}
|
where={"user_id": {"in": data.user_ids}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
## DELETE ASSOCIATED INVITATION LINKS
|
||||||
|
await prisma_client.db.litellm_invitationlink.delete_many(
|
||||||
|
where={"user_id": {"in": data.user_ids}}
|
||||||
|
)
|
||||||
|
|
||||||
## DELETE USERS
|
## DELETE USERS
|
||||||
deleted_users = await prisma_client.db.litellm_usertable.delete_many(
|
deleted_users = await prisma_client.db.litellm_usertable.delete_many(
|
||||||
where={"user_id": {"in": data.user_ids}}
|
where={"user_id": {"in": data.user_ids}}
|
||||||
|
|
|
@ -748,7 +748,9 @@ async def team_info(
|
||||||
detail={"message": "Malformed request. No team id passed in."},
|
detail={"message": "Malformed request. No team id passed in."},
|
||||||
)
|
)
|
||||||
|
|
||||||
if user_api_key_dict.team_id or (team_id != user_api_key_dict.team_id):
|
if user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN.value:
|
||||||
|
pass
|
||||||
|
elif user_api_key_dict.team_id or (team_id != user_api_key_dict.team_id):
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_403_FORBIDDEN,
|
status_code=status.HTTP_403_FORBIDDEN,
|
||||||
detail="key not allowed to access this team's info",
|
detail="key not allowed to access this team's info",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue