diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-04-01 15:07:35 +0200 |
---|---|---|
committer | npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com> | 2020-04-29 17:53:35 +0000 |
commit | d466a7b80834b6e31bfcb9d764816a01da0cbc7c (patch) | |
tree | 8283f4910aeb186c89085224ac109df5bbe4af85 /apps/files_sharing/lib | |
parent | b219eadb8f3f459f2c71e937dfd3542f0792da8e (diff) | |
download | nextcloud-server-d466a7b80834b6e31bfcb9d764816a01da0cbc7c.tar.gz nextcloud-server-d466a7b80834b6e31bfcb9d764816a01da0cbc7c.zip |
Allow to navigate to others with access from the sidebar
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 23d5057e05e..f2feb87373d 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -853,8 +853,12 @@ class ShareAPIController extends OCSController { throw new OCSNotFoundException($this->l->t('Could not lock path')); } - // current User has resharing rights ? - $this->confirmSharingRights($node); + if (!($node->getPermissions() & Constants::PERMISSION_SHARE)) { + throw new SharingRightsException('no sharing rights on this item'); + } + + // The current top parent we have access to + $parent = $node; // initiate real owner. $owner = $node->getOwner() @@ -882,10 +886,25 @@ class ShareAPIController extends OCSController { $nodes[] = $node; } + // The user that is requesting this list + $currentUserFolder = $this->rootFolder->getUserFolder($this->currentUser); + // for each nodes, retrieve shares. $shares = []; + foreach ($nodes as $node) { $getShares = $this->getFormattedShares($owner, $node, false, true); + + $currentUserNodes = $currentUserFolder->getById($node->getId()); + if (!empty($currentUserNodes)) { + $parent = array_pop($currentUserNodes); + } + + $subPath = $currentUserFolder->getRelativePath($parent->getPath()); + foreach ($getShares as &$share) { + $share['via_fileid'] = $parent->getId(); + $share['via_path'] = $subPath; + } $this->mergeFormattedShares($shares, $getShares); } |