pub struct ConsentRecord {
pub id: Uuid,
pub user_id: Uuid,
pub organization_id: Uuid,
pub consent_type: String,
pub accepted_at: DateTime<Utc>,
pub ip_address: Option<String>,
pub user_agent: Option<String>,
pub policy_version: String,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
ConsentRecord - GDPR Art. 7 / Art. 13-14 compliance
Tracks explicit user consent to privacy policy and terms of service. Each record is immutable (append-only) — new consent creates a new record. Audit trail includes IP address, user agent, and policy version.
Fields§
§id: Uuid§user_id: Uuid§organization_id: Uuid§consent_type: String§accepted_at: DateTime<Utc>§ip_address: Option<String>§user_agent: Option<String>§policy_version: String§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl ConsentRecord
impl ConsentRecord
Sourcepub fn new(
user_id: Uuid,
organization_id: Uuid,
consent_type: &str,
ip_address: Option<String>,
user_agent: Option<String>,
policy_version: Option<String>,
) -> Result<Self, String>
pub fn new( user_id: Uuid, organization_id: Uuid, consent_type: &str, ip_address: Option<String>, user_agent: Option<String>, policy_version: Option<String>, ) -> Result<Self, String>
Create a new consent record with validation
§Arguments
user_id: The user giving consentorganization_id: The organization contextconsent_type: Must be “privacy_policy” or “terms”ip_address: Optional IP for audit trailuser_agent: Optional browser user-agent for audit trailpolicy_version: Version of the policy being accepted (default “1.0”)
Sourcepub fn is_privacy_policy(&self) -> bool
pub fn is_privacy_policy(&self) -> bool
Check if this consent is for privacy policy
Trait Implementations§
Source§impl Clone for ConsentRecord
impl Clone for ConsentRecord
Source§fn clone(&self) -> ConsentRecord
fn clone(&self) -> ConsentRecord
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConsentRecord
impl Debug for ConsentRecord
Source§impl<'de> Deserialize<'de> for ConsentRecord
impl<'de> Deserialize<'de> for ConsentRecord
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ConsentRecord
impl PartialEq for ConsentRecord
Source§impl Serialize for ConsentRecord
impl Serialize for ConsentRecord
impl StructuralPartialEq for ConsentRecord
Auto Trait Implementations§
impl Freeze for ConsentRecord
impl RefUnwindSafe for ConsentRecord
impl Send for ConsentRecord
impl Sync for ConsentRecord
impl Unpin for ConsentRecord
impl UnwindSafe for ConsentRecord
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
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreCreates a shared type from an unshared type.