-
Notifications
You must be signed in to change notification settings - Fork 2
Specs M5 Trust Center Document
trust_center.models.document.TrustCenterDocument
A document published on the public Trust Center : a policy, a certificate, an audit report or any other shareable artifact. Its source is exactly one of a generated internal reports.Report or an inline uploaded file (stored as bytes, mirroring the Report storage so the same streaming download view serves both). The access level decides whether the document downloads directly (public) or behind a request-and-approval flow (gated).
File: trust_center/models/document.py
BaseModel subclass : UUID PK, sequential reference (prefix TCDO, e.g. TCDO-1), django-simple-history audit trail (excluding file_content), and the trust_center_publication lifecycle workflow.
| Field | Type | Constraints | Description |
|---|---|---|---|
id |
UUID | PK, auto-generated | Unique identifier. Also the public download handle (the one identifier the public document serializer exposes). |
reference |
string | auto TCDO-N, unique |
Business reference |
title |
string | required, max 255 | Public-facing document title |
description |
text | optional, blank default | Public-facing description |
access |
enum | required, default public
|
public (direct download) or gated (request + approval) |
requires_nda |
boolean | required, default True
|
Whether an NDA acceptance is required. Only meaningful for gated documents. |
report |
relation | FK -> reports.Report, PROTECT, nullable, blank |
Source report. related_name="trust_center_documents". Mutually exclusive with the inline file (enforced in clean()). |
file_content |
binary | nullable, blank, editable=False
|
Inline file bytes (UI-only upload path). Mutually exclusive with report. Never serialized; excluded from history. |
file_name |
string | optional, max 255, blank default | Inline file name |
content_type |
string | optional, max 100, blank default | Inline MIME type (used as the download Content-Type) |
display_order |
int |
PositiveIntegerField, default 0
|
Render order within the Documents section |
workflow_state |
string | indexed | Lifecycle state (trust_center_publication) |
created_by |
relation | FK -> User | Creator |
created_at / updated_at
|
datetime | auto | Timestamps |
tags |
relation | M2M -> Tag | Free tagging (from BaseModel) |
Meta.ordering = ["display_order", "title"]. HistoricalRecords(excluded_fields=["file_content"]).
| Value | Description |
|---|---|
public |
Anyone can download directly via the streaming view, subject to the dual gate and the global switch. |
gated |
Not directly downloadable. Requires a document request, curator approval, and a signed time-limited link. |
The source must be exactly one of report or inline content:
- both set ->
ValidationError("Provide either a source report or an uploaded file, not both.") - neither set ->
ValidationError("Provide a source report or upload a file.")
This one-of invariant (RG-TC-18) is enforced at the model level so it holds regardless of the entry point.
-
is_gated:access == gated. -
effective_file_name: the report's file name when report-backed, elsefile_name. -
get_file_bytes(): returns the bytes from the linked report'sfile_contentwhen report-backed, else the inlinefile_content, elseNone. -
workflow_perm_namespace:"trust_center.document".
Runs the shared trust_center_publication workflow (see README.md §2.3). Publish / unpublish / archive-from-published require approve; archiving a draft / unpublished entry is update.
DocumentQuerySet.published() returns an entry only when both:
- its
workflow_stateispublished, AND - either it has no report (inline-file document) OR its
report.statusiscompleted.
So a document backed by a report that is not yet completed (or was reverted) drops out of the public list automatically (RG-TC-08 / RG-TC-21). The global is_published switch is enforced separately at the view layer.
-
Public documents :
GET /trust/documents/<uuid>/download/streams the bytes withContent-Disposition: attachment. The view re-checks the global switch (404 if off), filters onpublished()ANDaccess = public, and 404s a missing / gated / empty document. Files are never exposed under/media/(RG-TC-20). -
Gated documents : not served by the public download view. They require the document request flow and a signed, expiring link (TTL via
TRUST_CENTER_DOWNLOAD_TTL), served byTrustCenterGatedDownloadViewat/trust/documents/download/<token>/.
| ID | Rule |
|---|---|
| RG-TC-18 | Source is exactly one of report or inline file_content (+ file_name + content_type); enforced in clean(). |
| RG-TC-19 |
access is public (direct) or gated (request + approval). |
| RG-TC-20 | Bytes are streamed through a view, never exposed under /media/. file_content is excluded from history and never serialized. |
| RG-TC-21 | A report-backed document is public only when its report is completed. requires_nda only applies to gated documents. |
| RG-TC-02 | The report FK is PROTECT : a report still referenced by a document cannot be hard-deleted. |
-
GET /documents/: list (search ontitle,description; ordering ondisplay_order,title,created_at;?workflow_state=filter). -
POST /documents/: create. A sourcereportis required via the API : the inline-upload path is UI-only, soDocumentSerializer.validate()rejects an API create withoutreport(the model's one-of invariant still holds). GET /documents/{id}/PUT/PATCH /documents/{id}/DELETE /documents/{id}/POST /documents/{id}/transition/
The management serializer exposes title, description, access, requires_nda, report, file_name, display_order (+ the read-only base fields). It never exposes file_content.
-
GET /trust/api/documents/: published documents viaPublicDocumentSerializer(fields:id,title,description,access,requires_nda). Theidis the download handle; bytes are fetched via the download endpoint, not this list. Also included in the aggregateGET /trust/api/. -
GET /trust/documents/<uuid>/download/: public document byte stream (see Download above).
-
list_trust_center_document/get_trust_center_document/create_trust_center_document/update_trust_center_document/delete_trust_center_document -
transition_trust_center_document/trust_center_document_allowed_transitions
| Codename | Description |
|---|---|
trust_center.document.read |
List / read documents |
trust_center.document.create |
Create a document |
trust_center.document.update |
Modify a document (and archive a draft / unpublished one) |
trust_center.document.delete |
Hard-delete a document |
trust_center.document.approve |
Publish / unpublish / archive a published document |
Gated-document requests have their own feature, document_request (see document-request.md).
-
reports.Report(reports.models.report.Report) : the optional source object; itsstatusgates publication and its bytes feed the download. - DocumentRequest : the request / approval / signed-link flow for gated documents.
- README.md : §2.7 (document rules), §6.3 (no raw file exposure).
Built from docs/ at v0.36.0. Edits made here are overwritten by the next release : open a pull request against the source instead.
- Administration
- Ask Cairn
- Assets and suppliers
- Compliance
- The dashboard
- Finding your way
- Getting started
- Incidents
- How records move
- Organisational context
- Reports and management review
- Risks
- Trust Center
- Architecture
- Configuration
- Contributing
- The documentation system
- Installation
- Internationalisation
- Operations
- Release process
- Security
- Testing
- Adding an assistant provider
- Adding a dashboard widget
- Adding a domain entity
- Declaring a lifecycle
- Adding an MCP tool
- Adding a REST endpoint
- Adding a report
- Interface conventions
- Dashboard widgets
- Lifecycles
- MCP tools
- MCP tool parameters : Assets
- MCP tool parameters : Compliance
- MCP tool parameters : Governance and context
- MCP tool parameters : General
- MCP tool parameters : Incidents
- MCP tool parameters : Reports and management review
- MCP tool parameters : Risks
- MCP tool parameters : System and administration
- MCP tool parameters : Trust Center
- Management commands
- Models
- Permissions
- REST endpoints
- Environment variables
- MCP server
- REST API
- Assistant module (Ask Cairn)
- Module 0: User Management and Access Control
- Module 1: Context and Organization
- Module 2: Asset Management
- Module 3: Compliance
- Module 4: Risk Management
- Module 4 bis - EBIOS Risk Manager
- Module 5 : Trust Center
- Module 6 : Security Incident Management
- Management review : ISO 27001:2022 compliance (clause 9.3)