You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
594 B
Python
29 lines
594 B
Python
# backend/app/security/audit.py — 보안 감사 로그 기록 (approval_log 와 구분)
|
|
import uuid
|
|
|
|
from sqlmodel import Session
|
|
|
|
from ..models import AuditLog
|
|
|
|
|
|
def audit(
|
|
session: Session,
|
|
user_id: str | None,
|
|
action: str,
|
|
*,
|
|
target: str | None = None,
|
|
ip: str | None = None,
|
|
detail: str | None = None,
|
|
) -> None:
|
|
session.add(
|
|
AuditLog(
|
|
id="al-" + uuid.uuid4().hex[:10],
|
|
user_id=user_id,
|
|
action=action,
|
|
target=target,
|
|
ip=ip,
|
|
detail=detail,
|
|
)
|
|
)
|
|
session.commit()
|