feat(backend): enforce admin-only ops endpoints and cover destructive cleanup smoke

restrict ops endpoints to admin-only access

block operator and viewer keys from admin maintenance routes
cover destructive pricing cleanup in smoke execution, not only preview

extend orchestration without regressing existing smoke stages
This commit is contained in:
greebo
2026-03-20 16:02:38 +03:00
parent 210981c953
commit 5aa35b1d04
10 changed files with 1090 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
from fastapi import Header, HTTPException, status
from fastapi import Depends, Header, HTTPException, status
from app.core.config import settings
from app.domain.roles import UserRole
@@ -31,3 +31,12 @@ async def require_api_key(
)
return role
async def require_admin_api_key(role: str = Depends(require_api_key)) -> str:
if role != UserRole.ADMIN.value:
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail="Admin role required",
)
return role