aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-11-01 15:01:01 +0100
committerJulius Härtl <jus@bitgrid.net>2018-11-02 12:10:49 +0100
commit0fc8a0f58eebc9bdac5544c114517f397838b38e (patch)
tree37ec7b8af2dd2890cecedd97f15e26e39a9f2734 /apps/files_sharing/lib
parent236a293f6a8b983ee832151c592a4e469ed0621e (diff)
downloadnextcloud-server-0fc8a0f58eebc9bdac5544c114517f397838b38e.tar.gz
nextcloud-server-0fc8a0f58eebc9bdac5544c114517f397838b38e.zip
user can have his resharing rights revoked, yet seeing created shares
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index b5c833a6f96..04c72b459b4 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -721,12 +721,18 @@ class ShareAPIController extends OCSController {
$shares = array_merge($shares, $federatedShares);
}
- $formatted = [];
+ $formatted = $miniFormatted = [];
$resharingRight = false;
foreach ($shares as $share) {
+ /** @var IShare $share */
try {
- $formatted[] = $this->formatShare($share, $path);
- if ($path !== null && !$resharingRight && $this->shareProviderResharingRights($this->currentUser, $share, $path)) {
+ $format = $this->formatShare($share, $path);
+ $formatted[] = $format;
+ if ($share->getSharedBy() === $this->currentUser) {
+ $miniFormatted[] = $format;
+ }
+
+ if (!$resharingRight && $this->shareProviderResharingRights($this->currentUser, $share, $path)) {
$resharingRight = true;
}
} catch (\Exception $e) {
@@ -735,7 +741,7 @@ class ShareAPIController extends OCSController {
}
if (!$resharingRight) {
- $formatted = [];
+ $formatted = $miniFormatted;
}
if ($include_tags) {
@@ -1126,13 +1132,14 @@ class ShareAPIController extends OCSController {
* @throws NotFoundException
* @throws \OCP\Files\InvalidPathException
*/
- private function shareProviderResharingRights(string $userId, IShare $share, Node $node): bool {
+ private function shareProviderResharingRights(string $userId, IShare $share, $node): bool {
+
if ($share->getShareOwner() === $userId) {
return true;
}
// we check that current user have parent resharing rights on the current file
- if (($node->getPermissions() & \OCP\Constants::PERMISSION_SHARE) !== 0) {
+ if ($node !== null && ($node->getPermissions() & \OCP\Constants::PERMISSION_SHARE) !== 0) {
return true;
}