From baa2c511235556f78c3b6f15c53f0cb72265a1ca Mon Sep 17 00:00:00 2001 From: Catalin Pit Date: Tue, 23 Dec 2025 13:08:54 +0200 Subject: [PATCH] feat: add delegate document ownership option (#2272) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using an API key created in a team context, the documents/templates’ owner always defaults to the team API token creator, rather than the actual uploader. For example, John creates the API key for the team "Lawyers". Tom and Maria use the API key to upload documents. All the uploaded documents are attributed to John. This makes it impossible to see who actually uploaded a document. The new feature allows users to enable document ownership delegation from the organization/team settings. --- .../dialogs/template-bulk-send-dialog.tsx | 18 +- .../forms/document-preferences-form.tsx | 50 + apps/remix/app/components/forms/signin.tsx | 16 +- .../components/tables/document-logs-table.tsx | 7 +- .../o.$orgUrl.settings.document.tsx | 2 + .../t.$teamUrl+/documents.$id.logs.tsx | 13 +- .../t.$teamUrl+/settings.document.tsx | 2 + .../organisation.sso.confirmation.$token.tsx | 18 +- package-lock.json | 879 +++++++++--------- .../server-only/envelope/create-envelope.ts | 63 +- packages/lib/types/document-audit-logs.ts | 14 + packages/lib/utils/document-audit-logs.ts | 7 + packages/lib/utils/organisations.ts | 1 + packages/lib/utils/teams.ts | 1 + .../migration.sql | 5 + packages/prisma/schema.prisma | 10 +- .../server/envelope-router/create-envelope.ts | 2 + .../envelope-router/create-envelope.types.ts | 5 + .../update-organisation-settings.ts | 6 + .../update-organisation-settings.types.ts | 1 + .../team-router/update-team-settings.ts | 2 + .../team-router/update-team-settings.types.ts | 1 + .../primitives/document-flow/add-fields.tsx | 22 +- .../template-flow/add-template-fields.tsx | 32 +- 24 files changed, 693 insertions(+), 484 deletions(-) create mode 100644 packages/prisma/migrations/20251203095514_delegate_document_ownership/migration.sql diff --git a/apps/remix/app/components/dialogs/template-bulk-send-dialog.tsx b/apps/remix/app/components/dialogs/template-bulk-send-dialog.tsx index 086e7bd39..0f5925741 100644 --- a/apps/remix/app/components/dialogs/template-bulk-send-dialog.tsx +++ b/apps/remix/app/components/dialogs/template-bulk-send-dialog.tsx @@ -137,12 +137,12 @@ export const TemplateBulkSendDialog = ({
-
+

CSV Structure

-

+

For each recipient, provide their email (required) and name (optional) in separate columns. Download the template CSV below for the correct format. @@ -153,7 +153,7 @@ export const TemplateBulkSendDialog = ({ Current recipients:

-
    +
      {recipients.map((recipient, index) => (
    • {recipient.name ? `${recipient.name} (${recipient.email})` : recipient.email} @@ -167,7 +167,7 @@ export const TemplateBulkSendDialog = ({ Download Template CSV -

      +

      Pre-formatted CSV template with example data.

@@ -200,14 +200,14 @@ export const TemplateBulkSendDialog = ({ ) : (
- + {value.name}