djblets.privacy.models¶
Database models for privacy-related data storage.
- class StoredConsentData(*args, **kwargs)[source]¶
Bases:
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]¶
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- audit_identifier[source]¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- time_added[source]¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_updated[source]¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- 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, }, ... ], ... }
- __str__()[source]¶
Return a string representation of the object.
- Returns:
The string representation of the object.
- Return type:
- __annotations__ = {}¶
- get_audit_trail_json()¶
- get_consent_grants_json()¶
- get_next_by_last_updated(*, field=<django.db.models.fields.DateTimeField: last_updated>, is_next=True, **kwargs)¶
- get_next_by_time_added(*, field=<django.db.models.fields.DateTimeField: time_added>, is_next=True, **kwargs)¶
- get_previous_by_last_updated(*, field=<django.db.models.fields.DateTimeField: last_updated>, is_next=False, **kwargs)¶
- get_previous_by_time_added(*, field=<django.db.models.fields.DateTimeField: time_added>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- set_audit_trail_json(json)¶
- set_consent_grants_json(json)¶
- user_id¶