#![deny(clippy::unwrap_used)]
#![deny(clippy::panic)]
#![warn(missing_docs)]
pub mod access_control;
pub mod anonymization;
pub mod audit;
pub mod compliance;
pub mod encryption;
pub mod error;
pub mod lineage;
pub mod multitenancy;
pub mod scanning;
pub use error::{Result, SecurityError};
#[derive(Debug, Clone)]
pub struct SecurityConfig {
pub encryption_enabled: bool,
pub access_control_enabled: bool,
pub audit_logging_enabled: bool,
pub lineage_tracking_enabled: bool,
pub multitenancy_enabled: bool,
}
impl Default for SecurityConfig {
fn default() -> Self {
Self {
encryption_enabled: true,
access_control_enabled: true,
audit_logging_enabled: true,
lineage_tracking_enabled: true,
multitenancy_enabled: false,
}
}
}
impl SecurityConfig {
pub fn new() -> Self {
Self::default()
}
pub fn with_encryption(mut self, enabled: bool) -> Self {
self.encryption_enabled = enabled;
self
}
pub fn with_access_control(mut self, enabled: bool) -> Self {
self.access_control_enabled = enabled;
self
}
pub fn with_audit_logging(mut self, enabled: bool) -> Self {
self.audit_logging_enabled = enabled;
self
}
pub fn with_lineage_tracking(mut self, enabled: bool) -> Self {
self.lineage_tracking_enabled = enabled;
self
}
pub fn with_multitenancy(mut self, enabled: bool) -> Self {
self.multitenancy_enabled = enabled;
self
}
pub fn secure() -> Self {
Self {
encryption_enabled: true,
access_control_enabled: true,
audit_logging_enabled: true,
lineage_tracking_enabled: true,
multitenancy_enabled: true,
}
}
pub fn minimal() -> Self {
Self {
encryption_enabled: true,
access_control_enabled: false,
audit_logging_enabled: false,
lineage_tracking_enabled: false,
multitenancy_enabled: false,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_security_config() {
let config = SecurityConfig::new()
.with_encryption(true)
.with_access_control(true);
assert!(config.encryption_enabled);
assert!(config.access_control_enabled);
}
#[test]
fn test_secure_config() {
let config = SecurityConfig::secure();
assert!(config.encryption_enabled);
assert!(config.access_control_enabled);
assert!(config.audit_logging_enabled);
assert!(config.lineage_tracking_enabled);
assert!(config.multitenancy_enabled);
}
#[test]
fn test_minimal_config() {
let config = SecurityConfig::minimal();
assert!(config.encryption_enabled);
assert!(!config.access_control_enabled);
assert!(!config.audit_logging_enabled);
}
}