diff --git a/enterprise/litellm_enterprise/proxy/management_endpoints/project_endpoints.py b/enterprise/litellm_enterprise/proxy/management_endpoints/project_endpoints.py index d652670c220..87b467cce4f 100644 --- a/enterprise/litellm_enterprise/proxy/management_endpoints/project_endpoints.py +++ b/enterprise/litellm_enterprise/proxy/management_endpoints/project_endpoints.py @@ -22,7 +22,7 @@ from litellm._uuid import uuid from litellm.proxy._types import * from litellm.proxy.auth.auth_checks import delete_cached_project_object from litellm.proxy.auth.user_api_key_auth import user_api_key_auth -from litellm.proxy.management_endpoints.common_utils import _is_user_team_admin, _set_object_metadata_field +from litellm.proxy.management_endpoints.common_utils import _set_object_metadata_field from litellm.proxy.management_helpers.utils import ( management_endpoint_wrapper, ) @@ -114,7 +114,11 @@ async def _check_user_permission_for_project( return False team: Final = LiteLLM_TeamTable.model_validate(team_row.model_dump()) - return _is_user_team_admin(user_api_key_dict, team) or user_api_key_dict.user_id in (team.admins or []) + is_role_admin: Final = any( + member.user_id is not None and member.user_id == user_api_key_dict.user_id and member.role == "admin" + for member in team.members_with_roles + ) + return is_role_admin or user_api_key_dict.user_id in (team.admins or []) async def _validate_team_exists(