pub struct ConsentManager { /* private fields */ }
Expand description
Main consent manager
Implementations§
Source§impl ConsentManager
impl ConsentManager
Sourcepub fn new(config: ConsentConfig, storage: Arc<dyn ConsentStorage>) -> Self
pub fn new(config: ConsentConfig, storage: Arc<dyn ConsentStorage>) -> Self
Create a new consent manager
Sourcepub async fn request_consent_individual(
&self,
subject_id: String,
consent_type: ConsentType,
legal_basis: LegalBasis,
purpose: String,
data_categories: Vec<String>,
consent_source: String,
expires_in_days: Option<u32>,
) -> Result<ConsentRecord, ConsentError>
pub async fn request_consent_individual( &self, subject_id: String, consent_type: ConsentType, legal_basis: LegalBasis, purpose: String, data_categories: Vec<String>, consent_source: String, expires_in_days: Option<u32>, ) -> Result<ConsentRecord, ConsentError>
Request consent from a subject with individual parameters
Sourcepub async fn request_consent(
&self,
request: ConsentRequest,
) -> Result<ConsentRecord, ConsentError>
pub async fn request_consent( &self, request: ConsentRequest, ) -> Result<ConsentRecord, ConsentError>
Request consent from a subject
Sourcepub async fn grant_consent(
&self,
subject_id: &str,
consent_type: &ConsentType,
source_ip: Option<String>,
action_source: String,
) -> Result<ConsentRecord, ConsentError>
pub async fn grant_consent( &self, subject_id: &str, consent_type: &ConsentType, source_ip: Option<String>, action_source: String, ) -> Result<ConsentRecord, ConsentError>
Grant consent
Sourcepub async fn withdraw_consent(
&self,
subject_id: &str,
consent_type: &ConsentType,
source_ip: Option<String>,
action_source: String,
) -> Result<ConsentRecord, ConsentError>
pub async fn withdraw_consent( &self, subject_id: &str, consent_type: &ConsentType, source_ip: Option<String>, action_source: String, ) -> Result<ConsentRecord, ConsentError>
Withdraw consent
Sourcepub async fn check_consent(
&self,
subject_id: &str,
consent_type: &ConsentType,
) -> Result<bool, ConsentError>
pub async fn check_consent( &self, subject_id: &str, consent_type: &ConsentType, ) -> Result<bool, ConsentError>
Check if consent is valid for a subject and type
Sourcepub async fn get_consent_summary(
&self,
subject_id: &str,
) -> Result<ConsentSummary, ConsentError>
pub async fn get_consent_summary( &self, subject_id: &str, ) -> Result<ConsentSummary, ConsentError>
Get consent summary for a subject
Sourcepub async fn cleanup_expired_consents(&self) -> Result<usize, ConsentError>
pub async fn cleanup_expired_consents(&self) -> Result<usize, ConsentError>
Clean up expired consents
Sourcepub async fn get_audit_trail(&self, subject_id: &str) -> Vec<ConsentAuditEntry>
pub async fn get_audit_trail(&self, subject_id: &str) -> Vec<ConsentAuditEntry>
Get audit trail for a subject
Auto Trait Implementations§
impl Freeze for ConsentManager
impl !RefUnwindSafe for ConsentManager
impl Send for ConsentManager
impl Sync for ConsentManager
impl Unpin for ConsentManager
impl !UnwindSafe for ConsentManager
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