refactor: standardize audit logging for ISO27001 compliance
This commit is contained in:
@@ -7,6 +7,7 @@ from gatehouse_app.extensions import db
|
||||
from gatehouse_app.models import Device
|
||||
from gatehouse_app.models.user import User
|
||||
from gatehouse_app.services.audit_service import AuditService
|
||||
from gatehouse_app.utils.constants import AuditAction
|
||||
from gatehouse_app.exceptions import (
|
||||
DeviceNotFoundError,
|
||||
DeviceAlreadyExistsError,
|
||||
@@ -74,7 +75,7 @@ def register_device(
|
||||
device.save()
|
||||
|
||||
AuditService.log_action(
|
||||
action="device.registered",
|
||||
action=AuditAction.DEVICE_REGISTERED,
|
||||
user_id=user_id,
|
||||
organization_id=organization_id,
|
||||
resource_type="device",
|
||||
@@ -142,7 +143,7 @@ def update_device(
|
||||
device.update(**kwargs)
|
||||
|
||||
AuditService.log_action(
|
||||
action="device.updated",
|
||||
action=AuditAction.DEVICE_UPDATED,
|
||||
user_id=user_id,
|
||||
organization_id=device.organization_id,
|
||||
resource_type="device",
|
||||
@@ -175,7 +176,7 @@ def remove_device(device_id: str, user_id: str) -> None:
|
||||
device.delete(soft=True)
|
||||
|
||||
AuditService.log_action(
|
||||
action="device.removed",
|
||||
action=AuditAction.DEVICE_REMOVED,
|
||||
user_id=user_id,
|
||||
organization_id=device.organization_id,
|
||||
resource_type="device",
|
||||
|
||||
Reference in New Issue
Block a user