diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index a58a1b4fda365..bb8af3a046fd2 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -373,6 +373,13 @@ public function checkSharedUserNotInResponse($user) { Assert::assertEquals(false, $this->isFieldInResponse('share_with', "$user")); } + /** + * @Then /^Share type "([^"]*)" should not be included in the response$/ + */ + public function checkShareTypeNotInResponse(int $shareType) { + Assert::assertEquals(false, $this->isFieldInResponse('share_type', $shareType)); + } + public function isUserOrGroupInSharedData($userOrGroup, $permissions = null) { $data = simplexml_load_string($this->response->getBody())->data[0]; foreach ($data as $element) { diff --git a/build/integration/sharing_features/sharing-v1-part2.feature b/build/integration/sharing_features/sharing-v1-part2.feature index 8cc97fe71ee58..7ea21a96750b3 100644 --- a/build/integration/sharing_features/sharing-v1-part2.feature +++ b/build/integration/sharing_features/sharing-v1-part2.feature @@ -23,6 +23,34 @@ Feature: sharing And User "user2" should be included in the response And User "user3" should not be included in the response + Scenario: getting all shares of a file with reshares with link share + Given user "user0" exists + And user "user1" exists + When as "user0" creating a share with + | path | textfile0.txt | + | shareType | 0 | + | shareWith | user1 | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + When as "user0" creating a share with + | path | textfile0.txt | + | shareType | 3 | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last link share can be downloaded + When As an "user1" + And sending "GET" to "/apps/files_sharing/api/v1/shares?reshares=true&path=textfile0 (2).txt" + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And User "user1" should not be included in the response + And Share type "3" should not be included in the response + When As an "user1" + And sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=true&path=textfile0 (2).txt" + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And User "user1" should be included in the response + And Share type "3" should not be included in the response + Scenario: getting all shares of a file with a received share after revoking the resharing rights Given user "user0" exists And user "user1" exists diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index ca3c33d6dbb63..ad1e447c04fde 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -706,14 +706,12 @@ public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offs if ($reshares === false) { $qb->andWhere($qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId))); } else { - if ($node === null) { - $qb->andWhere( - $qb->expr()->orX( - $qb->expr()->eq('uid_owner', $qb->createNamedParameter($userId)), - $qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId)) - ) - ); - } + $qb->andWhere( + $qb->expr()->orX( + $qb->expr()->eq('uid_owner', $qb->createNamedParameter($userId)), + $qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId)) + ) + ); } if ($node !== null) {