Update audit logging and dashboard
This commit is contained in:
@ -7,7 +7,17 @@ import logging
|
||||
from collections.abc import Iterator
|
||||
from contextlib import contextmanager
|
||||
|
||||
from sshecret.backend import AuditLog, Client, ClientFilter, Secret, SshecretBackend, Operation, SubSystem
|
||||
from sshecret.backend import (
|
||||
AuditLog,
|
||||
AuditFilter,
|
||||
AuditListResult,
|
||||
Client,
|
||||
ClientFilter,
|
||||
Secret,
|
||||
SshecretBackend,
|
||||
Operation,
|
||||
SubSystem,
|
||||
)
|
||||
from sshecret.backend.models import DetailedSecrets
|
||||
from sshecret.backend.api import AuditAPI
|
||||
from sshecret.crypto import encrypt_string, load_public_key
|
||||
@ -391,11 +401,39 @@ class AdminBackend:
|
||||
self,
|
||||
offset: int = 0,
|
||||
limit: int = 100,
|
||||
client_name: str | None = None,
|
||||
subsystem: str | None = None,
|
||||
**kwargs: str,
|
||||
) -> list[AuditLog]:
|
||||
"""Get audit log from backend."""
|
||||
return await self.audit.get(offset, limit, client_name, subsystem)
|
||||
"""Get audit log from backend.
|
||||
|
||||
Keyword Arguments:
|
||||
operation: str | None
|
||||
subsystem: str | None
|
||||
client_id: str | None
|
||||
client_name: str | None
|
||||
secret_id: str | None
|
||||
secret_name: str | None
|
||||
origin: str | None
|
||||
"""
|
||||
return await self.audit.get(offset, limit, **kwargs)
|
||||
|
||||
async def get_audit_log_detailed(
|
||||
self,
|
||||
offset: int = 0,
|
||||
limit: int = 100,
|
||||
**kwargs: str,
|
||||
) -> AuditListResult:
|
||||
"""Get audit log from backend.
|
||||
|
||||
Keyword Arguments:
|
||||
operation: str | None
|
||||
subsystem: str | None
|
||||
client_id: str | None
|
||||
client_name: str | None
|
||||
secret_id: str | None
|
||||
secret_name: str | None
|
||||
origin: str | None
|
||||
"""
|
||||
return await self.audit.get_detailed(offset, limit, **kwargs)
|
||||
|
||||
async def write_audit_message(
|
||||
self,
|
||||
@ -423,7 +461,7 @@ class AdminBackend:
|
||||
entry.subsystem = SubSystem.ADMIN
|
||||
|
||||
await self.audit.write_model_async(entry)
|
||||
#await self.backend.add_audit_log(entry)
|
||||
# await self.backend.add_audit_log(entry)
|
||||
|
||||
async def get_audit_log_count(self) -> int:
|
||||
"""Get audit log count."""
|
||||
|
||||
Reference in New Issue
Block a user