feat: add observer participant role for signature requests - #8143
Conversation
130da68 to
cfa42bc
Compare
8a74b3e to
6c8ddb1
Compare
|
If possible, could you also add a few screenshots to the PR description showing the observer flow? It would be useful to show:
Also, sorry for reviewing this PR while it is still a draft. I added the comments now only to help keep the work close to the expected flow and avoid bigger changes later. For the next review, it is better to add me as a reviewer and request the review when the PR is ready and is no longer a draft. After pushing new changes, when the PR is ready for review again, use the GitHub option to request my review again. This makes it clear when a new review is needed. |
No problem, I left it as a draft after the changes you requested. I was fixing the tests that broke. I'm going to add the observer flow and let you know when it's ready for review. |
vitormattos
left a comment
There was a problem hiding this comment.
Only a small change:
At file appinfo/info.xml, change from:
16.0.0-dev.1
to:
16.0.0-dev.2
This will make all environments of all developers to run the migration because will identify that the version was changed.
|
Could you also check this?
|
|
I found another case during manual testing. I created a signature request with one signer while the Observer policy was disabled. Then I enabled the Observer policy in Administration Settings and opened the same request again. The UI correctly showed
This happens because the frontend uses the current policy, while the backend keeps the old I think the expected behavior should be:
The saved policy state may need to move from There is also a frontend error handling problem in this case. The API returned HTTP 422 with the message
Please add regression tests for both parts:
|
|
The same rule also needs backend protection.
The API must reject a visible signature element when the Please add a unit test for this validation and an integration/Behat scenario that sends an observer |
Skip signing validation for observer UUIDs on getPdfFile, reject non-PDF fetch responses in VisibleElements, and assert the positions modal renders. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
…routing Details now opens the request sidebar for requesters who can also sign, and keeps the sign sidebar only when the user cannot manage the request. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
The frozen-geolocation associateToSigners mock still expected afterPersist as argument 9, which broke PHPUnit after the observer-role parameter was added. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Observers must never receive signingOrder numbers when ordered signing is enabled. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
…links Address PR review feedback for OBSERVING status in the contract, observer email wording, and authenticated deep-links for Account observers. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Keep RequireSignRequestUuid signer-only so observer UUIDs cannot hit write endpoints, and authorize PDF viewing via RequireParticipantUuid. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Avoid PHPUnit coverage risky failures when the trait stub also executes entity and page-aware controller code under beStrictAboutCoverageMetadata. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Show a workbench warning when both policies are enabled, and cover the email observer flow that cannot open authenticated-only validation. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Expose sibling effective flags via resolvedStateMeta so the Workbench warning is backed by policy resolution instead of frontend-only store reads. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Unify RequireSignRequestUuid and RequireParticipantUuid handling through authorizeRequiredUuid, and rename loadNextcloudFileFromSignRequestUuid to the role-neutral loadNextcloudFileFromUuid. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Centralize policy_snapshot effectiveValue reads in ObserverProfilePolicyValue so the service and file applier stay in sync. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Add groupCount, userCount, and everyoneCount so Policy Workbench editor specs type-check against the OpenAPI EffectivePolicyState shape. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
PolicySourceTest still constructed ValidationAccessPolicy with no args after the sibling-meta reader dependency was added. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Use the active resolve context when reading sibling effective booleans so group/user workbench warnings do not follow the admin personal posture. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Nextcloud cannot autowire IPolicySource, which broke policy resolution across PHPUnit, Behat, and Playwright. Also apply php-cs on the new test. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
The only remaining failure was list.feature with cURL error 52 while 195 other scenarios passed on the same run. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
SQLite Behat CI keeps failing randomly with cURL error 52 empty reply from the PHP built-in server while other DB matrices stay green. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
The retry was added for a SQLite empty-reply flake and changed request behavior for the whole suite; investigate that CI failure separately. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
When a disabled observer snapshot is upgraded or re-checked, use the file owner's policy context instead of the acting manager/current user. Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
…updates Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
becc745 to
11f30a2
Compare
|
Thanks a lot for all the work on this PR, Luiz. This one was not simple at all. We had many rounds of review, more than 40 comments, and a very large number of files to check. It also touches many important parts of LibreSign: database, frontend, backend, API, security, and some core flows of the project. Because of this, the review took longer than usual, but I think the result is much better and safer now. Thank you for your patience with all the feedback and for taking the time to investigate and fix each point. I know this was a lot of work. Great job getting this one to the finish line. |
Resolves: #6957
📝 Summary
Adds an observer participant role (UI label: Observer / Testemunha) to signature requests. Observers can follow document progress and open a read-only view of the request (including PDF and signature positions), but cannot sign or perform write/signing operations. The feature is gated by the policy
enable_observer_profile(default: disabled).Backend is the source of truth: role validation, signing denial, status/progress calculations, DocMDP signer limits, sequential signing, e-mail/notification routing, UUID authorization, and API contracts all treat observers separately from signers. The request UI exposes separate Signers and Observers lists when the policy is enabled.
Authorization is split explicitly:
RequireSignRequestUuid— signer-only (signing UI, id-docs, signature elements, and other write paths reject observers)RequireParticipantUuid— participant read-only (PDF/getPdfFileallows both signers and observers)Also includes: policy snapshots for existing requests/envelopes, preserve observers when reordering signers, require at least one signer before requesting signatures, hide signing-order numbers for observers, OBSERVING status
4in API summaries, observer mail copy (“ready to view”), Account observer deep-links to the authenticated read-only filelist, and focused regression coverage (PHPUnit, Vitest, Behat, Playwright).🧪 How to test
filelist/sign?uuid=…), not the public validation/sign flow.GET /apps/libresign/pdf/<OBSERVER_UUID>→ 200POST /api/v1/id-docsandPOST /api/v1/signature/elements→ 422 (“Observers cannot sign this document”)🎨 UI / Front‑end changes
canSignignores observers🚧 Tasks
l10n/)⚙️ API / Back‑end changes
participant_rolecolumn on sign requests (signer|observer) with migrationenable_observer_profile(defaultfalse, system/group/user scopes) with per-request/envelope policy snapshotOBSERVINGas status4in signer summaries; reject invalidParticipantRolevalues; freeze role after signedRequireParticipantUuid(read-only PDF) vsRequireSignRequestUuid(signer-only writes)composer openapiif necessary🚧 Tasks
participant_profile_id(column was never shipped in official migrations)✅ Checklist
composer openapi,npm run typescript:generate)🤖 AI (if applicable)