pub struct AuditManager { /* private fields */ }Expand description
Audit logging manager
Implementations§
Source§impl AuditManager
impl AuditManager
pub fn new(config: AuditConfig, db_pool: Arc<PgPool>) -> Self
Sourcepub async fn initialize(&self) -> Result<()>
pub async fn initialize(&self) -> Result<()>
Initialize audit logging system
Sourcepub async fn log_event(&self, event: AuditEvent) -> Result<()>
pub async fn log_event(&self, event: AuditEvent) -> Result<()>
Log an audit event
Sourcepub async fn log_authentication(
&self,
user_id: &str,
action: &str,
outcome: AuditOutcome,
ip_address: Option<String>,
details: HashMap<String, Value>,
) -> Result<()>
pub async fn log_authentication( &self, user_id: &str, action: &str, outcome: AuditOutcome, ip_address: Option<String>, details: HashMap<String, Value>, ) -> Result<()>
Log authentication event
Sourcepub async fn log_data_access(
&self,
user_id: Option<&str>,
resource: &str,
action: &str,
outcome: AuditOutcome,
details: HashMap<String, Value>,
) -> Result<()>
pub async fn log_data_access( &self, user_id: Option<&str>, resource: &str, action: &str, outcome: AuditOutcome, details: HashMap<String, Value>, ) -> Result<()>
Log data access event
Sourcepub async fn log_data_modification(
&self,
user_id: Option<&str>,
resource: &str,
action: &str,
outcome: AuditOutcome,
details: HashMap<String, Value>,
) -> Result<()>
pub async fn log_data_modification( &self, user_id: Option<&str>, resource: &str, action: &str, outcome: AuditOutcome, details: HashMap<String, Value>, ) -> Result<()>
Log data modification event
Sourcepub async fn log_security_event(
&self,
action: &str,
severity: AuditSeverity,
user_id: Option<&str>,
ip_address: Option<String>,
details: HashMap<String, Value>,
) -> Result<()>
pub async fn log_security_event( &self, action: &str, severity: AuditSeverity, user_id: Option<&str>, ip_address: Option<String>, details: HashMap<String, Value>, ) -> Result<()>
Log security event
Sourcepub async fn get_events(&self, filter: AuditFilter) -> Result<Vec<AuditEvent>>
pub async fn get_events(&self, filter: AuditFilter) -> Result<Vec<AuditEvent>>
Get audit events with filtering
Sourcepub async fn get_statistics(&self) -> Result<AuditStatistics>
pub async fn get_statistics(&self) -> Result<AuditStatistics>
Get audit statistics
Sourcepub async fn cleanup_old_events(&self) -> Result<u64>
pub async fn cleanup_old_events(&self) -> Result<u64>
Clean up old audit events based on retention policy
pub fn is_enabled(&self) -> bool
Auto Trait Implementations§
impl Freeze for AuditManager
impl !RefUnwindSafe for AuditManager
impl Send for AuditManager
impl Sync for AuditManager
impl Unpin for AuditManager
impl !UnwindSafe for AuditManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more