Merge pull request #5308 from BerriAI/litellm_team_admin_permissions

feat(user_api_key_auth.py): allow team admin to add new members to team
This commit is contained in:
Krish Dholakia 2024-08-21 14:21:22 -07:00 committed by GitHub
commit 509ae0ca71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 263 additions and 5 deletions

View file

@ -975,8 +975,6 @@ async def user_api_key_auth(
if not _is_user_proxy_admin(user_obj=user_obj): # if non-admin
if is_llm_api_route(route=route):
pass
elif is_llm_api_route(route=request["route"].name):
pass
elif (
route in LiteLLMRoutes.info_routes.value
): # check if user allowed to call an info route
@ -1046,11 +1044,16 @@ async def user_api_key_auth(
status_code=status.HTTP_403_FORBIDDEN,
detail=f"user not allowed to access this route, role= {_user_role}. Trying to access: {route}",
)
elif (
_user_role == LitellmUserRoles.INTERNAL_USER.value
and route in LiteLLMRoutes.internal_user_routes.value
):
pass
elif (
route in LiteLLMRoutes.self_managed_routes.value
): # routes that manage their own allowed/disallowed logic
pass
else:
user_role = "unknown"
user_id = "unknown"