diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2019-11-26 18:28:08 -0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-12-03 08:10:27 +0100 |
commit | ccf7d87c11112b63851940a6b157f07f954bd9ef (patch) | |
tree | 99b0cceece725133f05141b4c3efb5e993cc2268 /apps/files_sharing/lib/Controller | |
parent | 5794f14df905380cb179cc8eb13dec60d96dfcc6 (diff) | |
download | nextcloud-server-ccf7d87c11112b63851940a6b157f07f954bd9ef.tar.gz nextcloud-server-ccf7d87c11112b63851940a6b157f07f954bd9ef.zip |
integration tests
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
add tests on non-owner pov
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
duplicate
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
small fixes
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
removed tags
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'apps/files_sharing/lib/Controller')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index b470061c96b..208ea79c2ae 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -35,7 +35,6 @@ namespace OCA\Files_Sharing\Controller; use OCA\Files_Sharing\Exceptions\SharingRightsException; use OCA\Files_Sharing\External\Storage; use OCA\Files\Helper; -use OCA\Files_Sharing\External\Storage; use OCP\App\IAppManager; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSBadRequestException; @@ -641,9 +640,14 @@ class ShareAPIController extends OCSController { // filter out duplicate shares $known = []; - return array_filter($shares, function($share) use (&$known) { - if (in_array($share->getId(), $known)) { - return false; + + + $formatted = $miniFormatted = []; + $resharingRight = false; + $known = []; + foreach ($shares as $share) { + if (in_array($share->getId(), $known) || $share->getSharedWith() === $this->currentUser) { + continue; } try { @@ -673,7 +677,6 @@ class ShareAPIController extends OCSController { * The getShares function. * * @NoAdminRequired - * @NoCSRFRequired * * @param string $shared_with_me * @param string $reshares @@ -762,7 +765,9 @@ class ShareAPIController extends OCSController { try { /** @var IShare $share */ $format = $this->formatShare($share, $node); - $formatted[] = $format; + if ($share->getSharedWith() !== $this->currentUser) { + $formatted[] = $format; + } // let's also build a list of shares created // by the current user only, in case @@ -773,7 +778,7 @@ class ShareAPIController extends OCSController { // check if one of those share is shared with me // and if I have resharing rights on it - if (!$resharingRight && $this->shareProviderResharingRights($this->currentUser, $share, $path)) { + if (!$resharingRight && $this->shareProviderResharingRights($this->currentUser, $share, $node)) { $resharingRight = true; } } catch (InvalidPathException | NotFoundException $e) { @@ -1479,7 +1484,6 @@ class ShareAPIController extends OCSController { * @throws InvalidPathException */ private function shareProviderResharingRights(string $userId, IShare $share, $node): bool { - if ($share->getShareOwner() === $userId) { return true; } |