pub trait GdprRepository: Send + Sync {
// Required methods
fn aggregate_user_data<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
organization_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<GdprExport, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn anonymize_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn anonymize_owner<'life0, 'async_trait>(
&'life0 self,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_owner_ids_by_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
organization_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn check_legal_holds<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_user_anonymized<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
GDPR Repository port for data export and anonymization operations Implements GDPR Article 15 (Right to Access) and Article 17 (Right to Erasure)
Required Methods§
Sourcefn aggregate_user_data<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
organization_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<GdprExport, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn aggregate_user_data<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
organization_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<GdprExport, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Aggregate all personal data for a user (GDPR Article 15)
Collects data from:
- Users table
- Owners table
- Unit ownership relationships
- Expenses
- Documents
- Meetings attendance
§Arguments
user_id- UUID of the user requesting data exportorganization_id- Optional organization scope (None for SuperAdmin)
§Returns
Ok(GdprExport)- Complete data exportErr(String)- If user not found or database error
Sourcefn anonymize_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn anonymize_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Anonymize user account (GDPR Article 17)
Replaces personal identifiable information with anonymized placeholders:
- email → anonymized-{uuid}@deleted.local
- first_name → “Anonymized”
- last_name → “User”
- Sets is_anonymized = true
- Sets anonymized_at = NOW()
§Arguments
user_id- UUID of the user to anonymize
§Returns
Ok(())- Anonymization successfulErr(String)- If user not found, already anonymized, or database error
Sourcefn anonymize_owner<'life0, 'async_trait>(
&'life0 self,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn anonymize_owner<'life0, 'async_trait>(
&'life0 self,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Anonymize owner profile (GDPR Article 17)
Replaces personal identifiable information:
- email → None
- phone → None
- address, city, postal_code, country → None
- first_name → “Anonymized”
- last_name → “User”
- Sets is_anonymized = true
- Sets anonymized_at = NOW()
§Arguments
owner_id- UUID of the owner to anonymize
§Returns
Ok(())- Anonymization successfulErr(String)- If owner not found, already anonymized, or database error
Sourcefn find_owner_ids_by_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
organization_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_owner_ids_by_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
organization_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn check_legal_holds<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn check_legal_holds<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if user has legal holds preventing deletion
Verifies if user has outstanding financial obligations or legal requirements that prevent complete anonymization (e.g., unpaid expenses, ongoing legal proceedings).
§Arguments
user_id- UUID of the user
§Returns
Ok(Vec<String>)- List of hold reasons (empty if no holds)Err(String)- Database error