Coverage for .venv/lib/python3.13/site-packages/litellm/proxy/management_endpoints/sso_helper_utils.py: 23%

9 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 12:01 +0000

1from litellm.proxy._types import LitellmUserRoles 

2 

3 

4def check_is_admin_only_access(ui_access_mode: str | dict) -> bool: 

5 """Checks ui access mode is admin_only""" 

6 if isinstance(ui_access_mode, str): 

7 return ui_access_mode == "admin_only" 

8 else: 

9 return False 

10 

11 

12def has_admin_ui_access(user_role: str) -> bool: 

13 """ 

14 Check if the user has admin access to the UI. 

15 

16 Returns: 

17 bool: True if user is 'proxy_admin' or 'proxy_admin_view_only', False otherwise. 

18 """ 

19 

20 if user_role != LitellmUserRoles.PROXY_ADMIN.value and user_role != LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY.value: 

21 return False 

22 return True