Skip to content

Commit 778067f

Browse files
authored
Merge pull request #6139 from LibreSign/fix/filter-draft-sign-requests-in-list
fix: prevent signers from seeing files with DRAFT sign_request status
2 parents dd252f3 + adc396d commit 778067f

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

lib/Db/SignRequestMapper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,9 @@ private function getFilesAssociatedFilesWithMeQueryBuilder(string $userId, array
528528
$qb->expr()->eq('f.user_id', $qb->createNamedParameter($userId)),
529529
$qb->expr()->andX(
530530
$qb->expr()->eq('im.identifier_key', $qb->createNamedParameter(IdentifyMethodService::IDENTIFY_ACCOUNT)),
531-
$qb->expr()->eq('im.identifier_value', $qb->createNamedParameter($userId))
531+
$qb->expr()->eq('im.identifier_value', $qb->createNamedParameter($userId)),
532+
$qb->expr()->neq('f.status', $qb->createNamedParameter(File::STATUS_DRAFT)),
533+
$qb->expr()->neq('sr.status', $qb->createNamedParameter(SignRequestStatus::DRAFT->value)),
532534
)
533535
];
534536
$qb->where($qb->expr()->orX(...$or))->andWhere($qb->expr()->isNull('id.id'));

tests/integration/features/sign/sequential_signing.feature

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,26 @@ Feature: sequential-signing
4343
| users | [{"identify":{"account":"signer1"},"signingOrder":1},{"identify":{"account":"signer2"},"signingOrder":2}] |
4444
| name | Sequential Document |
4545
Then the response should have a status code 200
46-
And as user "signer2"
47-
And sending "get" to ocs "/apps/libresign/api/v1/file/list"
48-
And the response should have a status code 200
49-
And fetch field "(SIGN_UUID_2)ocs.data.data.0.signers.1.sign_uuid" from previous JSON response
50-
When sending "post" to ocs "/apps/libresign/api/v1/sign/uuid/<SIGN_UUID_2>"
51-
| method | clickToSign |
52-
Then the response should have a status code 422
53-
And as user "signer1"
54-
And sending "get" to ocs "/apps/libresign/api/v1/file/list"
55-
And the response should have a status code 200
46+
# Signer2 should NOT see the file yet (their sign_request is in DRAFT status)
47+
Given as user "signer2"
48+
When sending "get" to ocs "/apps/libresign/api/v1/file/list"
49+
Then the response should have a status code 200
50+
And the response should be a JSON array with the following mandatory values
51+
| key | value |
52+
| (jq).ocs.data.data\|length | 0 |
53+
# Signer1 can see and sign the document
54+
Given as user "signer1"
55+
When sending "get" to ocs "/apps/libresign/api/v1/file/list"
56+
Then the response should have a status code 200
5657
And fetch field "(SIGN_UUID_1)ocs.data.data.0.signers.0.sign_uuid" from previous JSON response
5758
When sending "post" to ocs "/apps/libresign/api/v1/sign/uuid/<SIGN_UUID_1>"
5859
| method | clickToSign |
5960
Then the response should have a status code 200
60-
And as user "signer2"
61+
# After signer1 signs, signer2 should now see the file and be able to sign
62+
Given as user "signer2"
63+
When sending "get" to ocs "/apps/libresign/api/v1/file/list"
64+
Then the response should have a status code 200
65+
And fetch field "(SIGN_UUID_2)ocs.data.data.0.signers.1.sign_uuid" from previous JSON response
6166
When sending "post" to ocs "/apps/libresign/api/v1/sign/uuid/<SIGN_UUID_2>"
6267
| method | clickToSign |
6368
Then the response should have a status code 200

0 commit comments

Comments
 (0)