Jump to >

djblets.privacy.models

Database models for privacy-related data storage.

class StoredConsentData(*args, **kwargs)[source]

Stored information about a user’s current and past consent decisions.

This tracks what parts of a product a user has consented to, and how those decisions have changed in the past. The model is not meant to be queried directly by applications, but rather used behind the scenes by DatabaseConsentTracker.

Entries are associated with a user in the database (when available), but are also associated with a piece of identifying data for the purposes of privacy auditing. The identifying data (stored in audit_identifier) can be erased at any point without impacting the model, and can also store encrypted values if needed by the application.

consent_grants[source]

The current consent grant state of each consent-tracking item.

This is in the form of:

{
    "<consent_requirement_id>": bool,
    ...
}

Each boolean indicates if consent is granted or denied.

audit_trail[source]

An audit trail of each consent-tracking decision.

This is in the form of:

{
    "<consent_requirement_id>": [
        {
            "identifier": string,
            "granted": bool,
            "timestamp": UTC datetime,
            "source": string,
            "memo": string,
        },
        ...
    ],
    ...
}