Download src/models/audit_log.py from arimatch1/crewhub: direct link, hf CLI and curl.
- Browser
- Download file 1.27 kB
-
https://huggingface.co/spaces/arimatch1/crewhub/resolve/main/src/models/audit_log.py
- Command line
-
hf download hf://spaces/arimatch1/crewhub/src/models/audit_log.py
-
curl -L -o audit_log.py https://huggingface.co/spaces/arimatch1/crewhub/resolve/main/src/models/audit_log.py
1.27 kB
| # Copyright (c) 2026 CrewHub. All rights reserved. | |
| # Proprietary and confidential. See LICENSE for details. | |
| """Audit log for SOC 2 compliance — immutable record of privileged actions.""" | |
| import uuid | |
| from datetime import datetime | |
| from sqlalchemy import DateTime, String, Text, Uuid, func | |
| from sqlalchemy.orm import Mapped, mapped_column | |
| from src.database import Base | |
| class AuditLog(Base): | |
| __tablename__ = "audit_logs" | |
| id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, default=uuid.uuid4) | |
| actor_user_id: Mapped[uuid.UUID | None] = mapped_column(Uuid, nullable=True, index=True) | |
| action: Mapped[str] = mapped_column(String(100), nullable=False, index=True) | |
| target_type: Mapped[str | None] = mapped_column(String(50), nullable=True) | |
| target_id: Mapped[str | None] = mapped_column(String(255), nullable=True) | |
| old_value: Mapped[str | None] = mapped_column(Text, nullable=True) | |
| new_value: Mapped[str | None] = mapped_column(Text, nullable=True) | |
| ip_address: Mapped[str | None] = mapped_column(String(45), nullable=True) | |
| user_agent: Mapped[str | None] = mapped_column(String(500), nullable=True) | |
| created_at: Mapped[datetime] = mapped_column( | |
| DateTime, nullable=False, server_default=func.now(), index=True | |
| ) | |