取消AUTH_DISABLED参数

This commit is contained in:
2026-02-24 10:45:53 +08:00
parent 780a48d927
commit 020432ad0e
8 changed files with 8 additions and 28 deletions

View File

@@ -20,8 +20,6 @@ async def get_current_metadata_user(
keycloak_sub: UUID = Depends(get_current_keycloak_sub),
metadata_repo: MetadataRepository = Depends(get_metadata_repository),
):
if settings.AUTH_DISABLED:
return _AuthBypassUser()
user = await metadata_repo.get_user_by_keycloak_id(keycloak_sub)
if not user or not user.is_active:
raise HTTPException(
@@ -33,8 +31,6 @@ async def get_current_metadata_user(
async def get_current_metadata_admin(
user=Depends(get_current_metadata_user),
):
if settings.AUTH_DISABLED:
return user
if user.is_superuser or user.role == "admin":
return user
raise HTTPException(