mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
fix user_role test
This commit is contained in:
parent
dc51fec22e
commit
89bb364775
2 changed files with 14 additions and 3 deletions
|
@ -1086,7 +1086,16 @@ class UserAPIKeyAuth(
|
||||||
"""
|
"""
|
||||||
|
|
||||||
api_key: Optional[str] = None
|
api_key: Optional[str] = None
|
||||||
user_role: Optional[Literal["proxy_admin", "app_owner", "app_user"]] = None
|
user_role: Optional[
|
||||||
|
Literal[
|
||||||
|
"proxy_admin",
|
||||||
|
"proxy_admin_view_only",
|
||||||
|
"internal_user",
|
||||||
|
"internal_user_view_only",
|
||||||
|
"team",
|
||||||
|
"customer",
|
||||||
|
]
|
||||||
|
] = None
|
||||||
allowed_model_region: Optional[Literal["eu"]] = None
|
allowed_model_region: Optional[Literal["eu"]] = None
|
||||||
|
|
||||||
@root_validator(pre=True)
|
@root_validator(pre=True)
|
||||||
|
|
|
@ -507,7 +507,9 @@ async def user_api_key_auth(
|
||||||
|
|
||||||
if route in LiteLLMRoutes.public_routes.value:
|
if route in LiteLLMRoutes.public_routes.value:
|
||||||
# check if public endpoint
|
# check if public endpoint
|
||||||
return UserAPIKeyAuth(user_role="app_owner")
|
return UserAPIKeyAuth(
|
||||||
|
user_role=LitellmUserRoles.INTERNAL_USER_VIEW_ONLY.value
|
||||||
|
)
|
||||||
|
|
||||||
if general_settings.get("enable_jwt_auth", False) == True:
|
if general_settings.get("enable_jwt_auth", False) == True:
|
||||||
is_jwt = jwt_handler.is_jwt(token=api_key)
|
is_jwt = jwt_handler.is_jwt(token=api_key)
|
||||||
|
@ -666,7 +668,7 @@ async def user_api_key_auth(
|
||||||
team_object.rpm_limit if team_object is not None else None
|
team_object.rpm_limit if team_object is not None else None
|
||||||
),
|
),
|
||||||
team_models=team_object.models if team_object is not None else [],
|
team_models=team_object.models if team_object is not None else [],
|
||||||
user_role="app_owner",
|
user_role=LitellmUserRoles.INTERNAL_USER.value,
|
||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
org_id=org_id,
|
org_id=org_id,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue