[PR #2272] [MERGED] feat: add delegate document ownership option #2171

Closed
opened 2026-02-26 20:32:44 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/2272
Author: @catalinpit
Created: 12/3/2025
Status: Merged
Merged: 12/23/2025
Merged by: @Mythie

Base: mainHead: feat/api-custom-document-owner


📝 Commits (7)

  • 5deb59b feat: add delegate document ownership option to document preferences form
  • bb1b49e feat: implement delegated document ownership feature across settings and envelope creation
  • 36a3142 feat: update DocumentLogsTable to include userId and display creator information in logs page
  • 7004721 refactor: update document preferences form and clean up document information handling in logs page
  • 7f1205c chore: clean document owner retrieval in logs page and improve error handling in envelope creation
  • e41f7fd chore: merged main
  • 88a066b chore: tidy up variable names

📊 Changes

24 files changed (+693 additions, -484 deletions)

View changed files

📝 apps/remix/app/components/dialogs/template-bulk-send-dialog.tsx (+9 -9)
📝 apps/remix/app/components/forms/document-preferences-form.tsx (+50 -0)
📝 apps/remix/app/components/forms/signin.tsx (+8 -8)
📝 apps/remix/app/components/tables/document-logs-table.tsx (+5 -2)
📝 apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.document.tsx (+2 -0)
📝 apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsx (+7 -6)
📝 apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.document.tsx (+2 -0)
📝 apps/remix/app/routes/_unauthenticated+/organisation.sso.confirmation.$token.tsx (+9 -9)
📝 package-lock.json (+461 -418)
📝 packages/lib/server-only/envelope/create-envelope.ts (+62 -1)
📝 packages/lib/types/document-audit-logs.ts (+14 -0)
📝 packages/lib/utils/document-audit-logs.ts (+7 -0)
📝 packages/lib/utils/organisations.ts (+1 -0)
📝 packages/lib/utils/teams.ts (+1 -0)
packages/prisma/migrations/20251203095514_delegate_document_ownership/migration.sql (+5 -0)
📝 packages/prisma/schema.prisma (+6 -4)
📝 packages/trpc/server/envelope-router/create-envelope.ts (+2 -0)
📝 packages/trpc/server/envelope-router/create-envelope.types.ts (+5 -0)
📝 packages/trpc/server/organisation-router/update-organisation-settings.ts (+6 -0)
📝 packages/trpc/server/organisation-router/update-organisation-settings.types.ts (+1 -0)

...and 4 more files

📄 Description

Description

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.

SCR-20251211-ntyq

Once the setting is enabled, a new document owner can be specified in the API request as follows:

{
  "title": "Delegated document",
  "type": "DOCUMENT",
  "delegatedDocumentOwner": "manager@documenso.com",
  "recipients": [
    {
      "email": "firstuser@mail.com",
      "name": "First User",
      "role": "SIGNER"
    },
    {
      "email": "seconduser@mail.com",
      "name": "Second User",
      "role": "SIGNER"
    },
    {
      "email": "thirduser@mail.com",
      "name": "Third User",
      "role": "SIGNER"
    }
  ]
}

The document ownership delegation is reflected in the audit log.

SCR-20251211-nxql

Checklist

  • I have tested these changes locally and they work as expected.
  • I have added/updated tests that prove the effectiveness of these changes.
  • I have updated the documentation to reflect these changes, if applicable.
  • I have followed the project's coding style guidelines.
  • I have addressed the code review feedback from the previous submission, if applicable.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/2272 **Author:** [@catalinpit](https://github.com/catalinpit) **Created:** 12/3/2025 **Status:** ✅ Merged **Merged:** 12/23/2025 **Merged by:** [@Mythie](https://github.com/Mythie) **Base:** `main` ← **Head:** `feat/api-custom-document-owner` --- ### 📝 Commits (7) - [`5deb59b`](https://github.com/documenso/documenso/commit/5deb59b6e0a90befda6572d24c085e2f2d1cee35) feat: add delegate document ownership option to document preferences form - [`bb1b49e`](https://github.com/documenso/documenso/commit/bb1b49e4e1f837dbb9060c61df8df896d724e5d6) feat: implement delegated document ownership feature across settings and envelope creation - [`36a3142`](https://github.com/documenso/documenso/commit/36a3142e295b17c5ed680ee0cfe6ffb1a1e6c510) feat: update DocumentLogsTable to include userId and display creator information in logs page - [`7004721`](https://github.com/documenso/documenso/commit/70047216088c08ef656aae4b0d46ac6852f58911) refactor: update document preferences form and clean up document information handling in logs page - [`7f1205c`](https://github.com/documenso/documenso/commit/7f1205c4698d4c0f755aea7f31d071f5efb0dc0b) chore: clean document owner retrieval in logs page and improve error handling in envelope creation - [`e41f7fd`](https://github.com/documenso/documenso/commit/e41f7fdc7806c6f75f76767ca81bc527d517c604) chore: merged main - [`88a066b`](https://github.com/documenso/documenso/commit/88a066b2042f7e7cd8b2aa0fb9d5203ca0d0b256) chore: tidy up variable names ### 📊 Changes **24 files changed** (+693 additions, -484 deletions) <details> <summary>View changed files</summary> 📝 `apps/remix/app/components/dialogs/template-bulk-send-dialog.tsx` (+9 -9) 📝 `apps/remix/app/components/forms/document-preferences-form.tsx` (+50 -0) 📝 `apps/remix/app/components/forms/signin.tsx` (+8 -8) 📝 `apps/remix/app/components/tables/document-logs-table.tsx` (+5 -2) 📝 `apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.document.tsx` (+2 -0) 📝 `apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsx` (+7 -6) 📝 `apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.document.tsx` (+2 -0) 📝 `apps/remix/app/routes/_unauthenticated+/organisation.sso.confirmation.$token.tsx` (+9 -9) 📝 `package-lock.json` (+461 -418) 📝 `packages/lib/server-only/envelope/create-envelope.ts` (+62 -1) 📝 `packages/lib/types/document-audit-logs.ts` (+14 -0) 📝 `packages/lib/utils/document-audit-logs.ts` (+7 -0) 📝 `packages/lib/utils/organisations.ts` (+1 -0) 📝 `packages/lib/utils/teams.ts` (+1 -0) ➕ `packages/prisma/migrations/20251203095514_delegate_document_ownership/migration.sql` (+5 -0) 📝 `packages/prisma/schema.prisma` (+6 -4) 📝 `packages/trpc/server/envelope-router/create-envelope.ts` (+2 -0) 📝 `packages/trpc/server/envelope-router/create-envelope.types.ts` (+5 -0) 📝 `packages/trpc/server/organisation-router/update-organisation-settings.ts` (+6 -0) 📝 `packages/trpc/server/organisation-router/update-organisation-settings.types.ts` (+1 -0) _...and 4 more files_ </details> ### 📄 Description ## Description 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. <img width="1494" height="860" alt="SCR-20251211-ntyq" src="https://github.com/user-attachments/assets/25dd317b-14d6-4a67-823c-53f3f9243beb" /> Once the setting is enabled, a new document owner can be specified in the API request as follows: ``` { "title": "Delegated document", "type": "DOCUMENT", "delegatedDocumentOwner": "manager@documenso.com", "recipients": [ { "email": "firstuser@mail.com", "name": "First User", "role": "SIGNER" }, { "email": "seconduser@mail.com", "name": "Second User", "role": "SIGNER" }, { "email": "thirduser@mail.com", "name": "Third User", "role": "SIGNER" } ] } ``` The document ownership delegation is reflected in the audit log. <img width="1495" height="861" alt="SCR-20251211-nxql" src="https://github.com/user-attachments/assets/5d162b9b-9daf-433c-9804-5b2b0cffbd18" /> ## Checklist <!--- Please check the boxes that apply to this pull request. --> <!--- You can add or remove items as needed. --> - [x] I have tested these changes locally and they work as expected. - [ ] I have added/updated tests that prove the effectiveness of these changes. - [ ] I have updated the documentation to reflect these changes, if applicable. - [x] I have followed the project's coding style guidelines. - [ ] I have addressed the code review feedback from the previous submission, if applicable. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 20:32:44 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#2171
No description provided.