Jump to >

djblets.privacy.models

Database models for privacy-related data storage.

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

Bases: django.db.models.base.Model

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.

user[source]
consent_grants = None

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 = None

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,
        },
        ...
    ],
    ...
}
__str__()[source]
__unicode__()[source]

Return a string representation of the object.

Returns:The string representation of the object.
Return type:unicode
get_audit_trail_json()[source]
get_next_by_last_updated(**morekwargs)[source]
get_next_by_time_added(**morekwargs)[source]
get_previous_by_last_updated(**morekwargs)[source]
get_previous_by_time_added(**morekwargs)[source]
set_audit_trail_json(json)[source]