Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

487 B
Raw Blame
from posthog.models.team import Team


def is_ai_data_processing_approved(team_id: int) -> bool:
    """Fresh read of the org's AI data-processing consent, fail-closed when the team or org is missing."""
    return bool(
        Team.objects.filter(id=team_id).values_list("organization__is_ai_data_processing_approved", flat=True).first()
    )


# Error code clients key on to point the user at the organization AI setting.
AI_CONSENT_REQUIRED_CODE = "ai_data_processing_not_approved"