Skip to content

Library GDPR classification controls (feature 057)

Client AdminPower User

Library GDPR classification controls (feature 057)

Section titled “Library GDPR classification controls (feature 057)”

Summary: Adds GDPR classification selection for document uploads in the library and team documents surfaces, using the existing backend support.

Feature 057 (name: library-gdpr-controls) provides GDPR classification controls for documents uploaded via Ajutant’s document library and related upload surfaces.

The published spec states that feature 056 already enforced GDPR classification for the chat upload flow only. Feature 057 extends classification prompting to other upload surfaces that previously uploaded documents without a classification level or without enforcing team clearance.

The spec identifies a GDPR compliance gap: certain surfaces still upload documents without prompting for a classification level or enforcing team clearance.

Feature 057 targets these surfaces:

  • Document Library page (app/(app)/documents/page.tsx), uploads via POST /api/documents
  • Team Documents tab (TeamDocumentsSection.tsx), direct file upload and “Paste Text” dialog, uploads via POST /api/documents
  • Assistant Knowledge Base (KnowledgeBaseTab.tsx), uploads documents to assistants

The spec states that the backend POST /api/documents route:

  • accepts an optional classificationLevel form field
  • computes retention based on the classification

It also states that the following already exist from feature 056:

  • a ClassificationPicker component
  • a validateClearance() function
  • Assistant Knowledge Base uploads are in scope for classification (add a user story for Knowledge Base upload classification).
  • User-scoped document uploads require classification selection, but no team clearance check applies.

User story 1: document library upload classification (P1)

Section titled “User story 1: document library upload classification (P1)”

Goal: When a user uploads through the main Document Library page, they must select a confidentiality classification before the upload begins.

Acceptance scenarios (as specified):

  1. Given a user is on the Document Library page, When they click “Browse” or drag-and-drop a file, Then a classification picker is shown before the upload begins
  2. Given a user has selected a file and the classification picker is shown, When they select a classification level and confirm, Then the file is uploaded with that classification level in the form data
  3. Given a user has selected a file and the classification picker is shown, When they cancel, Then the file is not uploaded and the picker is dismissed
  4. Given a user selects multiple files at once, When the classification picker is shown, Then one classification level applies to all files in the batch
  5. Given a user drags and drops a file onto the upload zone, When the file is dropped, Then the classification picker appears before upload proceeds
  6. Given a user is uploading to “My Documents” (user scope), When the classification picker is shown, Then all classification levels are available (no team clearance restriction applies)

User story 2: team documents upload classification (P1)

Section titled “User story 2: team documents upload classification (P1)”

Goal: When an admin uploads through the Team Documents tab, they must select a classification, and the server must enforce that the chosen classification does not exceed the team’s clearance level.

Acceptance scenarios (as specified):

  • The spec includes an independent test and starts listing acceptance scenarios, including blocking selection above the team’s clearance level.

Note: The provided spec excerpt cuts off mid-way through the Team Documents acceptance scenarios. Reviewers should use the full spec text (if available) to complete any remaining acceptance criteria.

How the classification is expected to be sent

Section titled “How the classification is expected to be sent”

From the spec’s backend description and user story 1 acceptance criteria:

  • The selected classification level should be sent to the server as classificationLevel in the POST /api/documents form data.
  • The server then applies the classification to the created document and computes retention.
  • Upload a document via the Document Library page.
  • Verify the classification picker appears before upload.
  • Confirm a level is selected and the document is created with the correct classification.
  • Cancel the picker and verify the file is not uploaded.
  • Upload multiple files in one batch and verify one classification level applies to all.
  • Drag-and-drop a file and verify the picker appears before upload proceeds.
  • Upload to “My Documents” (user scope) and verify all classification levels are available (no team clearance restriction).
  • Upload via the Team Documents tab.
  • Verify the classification picker appears.
  • Confirm a valid classification is accepted and the document is created with that classification.
  • Attempt to select a classification above the team’s clearance and verify it is blocked.
  • The spec states Knowledge Base uploads are in scope for classification.
  • Verify the classification picker is shown for Knowledge Base uploads and that the selected classification is applied when the document is uploaded.
  • Feature status: partial (as published in the feature catalogue entry).

Implementation notes for reviewers (grounded in the spec)

Section titled “Implementation notes for reviewers (grounded in the spec)”
  • The surfaces listed in the spec currently upload without prompting for classification or enforcing clearance.
  • The UI should use the existing ClassificationPicker and the existing validateClearance() logic (from feature 056) where team clearance enforcement is required.
  • Ensure POST /api/documents receives classificationLevel from the UI.

If you have the complete Team Documents acceptance criteria text (the excerpt ends mid-sentence), add it to this document so the testing checklist fully matches the spec.