from fastapi import HTTPException, status from app.core.security.operation_policy import business_mutations_enabled READ_ONLY_OPERATION_DISABLED = "This service is read-only; data mutation operations are disabled" def require_operations_enabled(detail: str = READ_ONLY_OPERATION_DISABLED) -> None: """Reject mutation-oriented endpoints when the product is running read-only.""" if not business_mutations_enabled(): raise HTTPException( status_code=status.HTTP_405_METHOD_NOT_ALLOWED, detail=detail, )