mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
* fix(ui_sso.py): fix faulty admin only check Fixes https://github.com/BerriAI/litellm/issues/6286 * refactor(sso_helper_utils.py): refactor /sso/callback to use helper utils, covered by unit testing Prevent future regressions * feat(prompt_factory): support 'ensure_alternating_roles' param Closes https://github.com/BerriAI/litellm/issues/6257 * fix(proxy/utils.py): add dailytagspend to expected views * feat(auth_utils.py): support setting regex for clientside auth credentials Fixes https://github.com/BerriAI/litellm/issues/6203 * build(cookbook): add tutorial for mlflow + langchain + litellm proxy tracing * feat(argilla.py): add argilla logging integration Closes https://github.com/BerriAI/litellm/issues/6201 * fix: fix linting errors * fix: fix ruff error * test: fix test * fix: update vertex ai assumption - parts not always guaranteed (#6296) * docs(configs.md): add argila env var to docs
24 lines
636 B
Python
24 lines
636 B
Python
from fastapi import HTTPException
|
|
|
|
from litellm.proxy._types import LitellmUserRoles
|
|
|
|
|
|
def check_is_admin_only_access(ui_access_mode: str) -> bool:
|
|
"""Checks ui access mode is admin_only"""
|
|
return ui_access_mode == "admin_only"
|
|
|
|
|
|
def has_admin_ui_access(user_role: str) -> bool:
|
|
"""
|
|
Check if the user has admin access to the UI.
|
|
|
|
Returns:
|
|
bool: True if user is 'proxy_admin' or 'proxy_admin_view_only', False otherwise.
|
|
"""
|
|
|
|
if (
|
|
user_role != LitellmUserRoles.PROXY_ADMIN.value
|
|
and user_role != LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY.value
|
|
):
|
|
return False
|
|
return True
|