mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
fix literal usage
This commit is contained in:
parent
4861ff2fd4
commit
a4b6a959d8
4 changed files with 82 additions and 65 deletions
|
@ -15,6 +15,7 @@ from litellm.proxy._types import (
|
|||
LiteLLM_TeamTable,
|
||||
LiteLLMRoutes,
|
||||
LiteLLM_OrganizationTable,
|
||||
LitellmUserRoles,
|
||||
)
|
||||
from typing import Optional, Literal, Union
|
||||
from litellm.proxy.utils import PrismaClient
|
||||
|
@ -133,7 +134,11 @@ def _allowed_routes_check(user_route: str, allowed_routes: list) -> bool:
|
|||
|
||||
|
||||
def allowed_routes_check(
|
||||
user_role: Literal["proxy_admin", "team", "user"],
|
||||
user_role: Literal[
|
||||
LitellmUserRoles.PROXY_ADMIN,
|
||||
LitellmUserRoles.TEAM,
|
||||
LitellmUserRoles.INTERNAL_USER,
|
||||
],
|
||||
user_route: str,
|
||||
litellm_proxy_roles: LiteLLM_JWTAuth,
|
||||
) -> bool:
|
||||
|
@ -141,14 +146,14 @@ def allowed_routes_check(
|
|||
Check if user -> not admin - allowed to access these routes
|
||||
"""
|
||||
|
||||
if user_role == "proxy_admin":
|
||||
if user_role == LitellmUserRoles.PROXY_ADMIN:
|
||||
is_allowed = _allowed_routes_check(
|
||||
user_route=user_route,
|
||||
allowed_routes=litellm_proxy_roles.admin_allowed_routes,
|
||||
)
|
||||
return is_allowed
|
||||
|
||||
elif user_role == "team":
|
||||
elif user_role == LitellmUserRoles.TEAM:
|
||||
if litellm_proxy_roles.team_allowed_routes is None:
|
||||
"""
|
||||
By default allow a team to call openai + info routes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue