diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-01-29 15:26:04 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-01-29 15:36:23 +0100 |
commit | a24e7f655885b5047e73036acb2f1706803a2b65 (patch) | |
tree | 368b0e20962529da9a1fe6d0a48c0842945ebde8 /apps/files_sharing/api/share20ocs.php | |
parent | 8ad45dad38c2c502ac1fae48e4bc12ec3dcfd565 (diff) | |
download | nextcloud-server-a24e7f655885b5047e73036acb2f1706803a2b65.tar.gz nextcloud-server-a24e7f655885b5047e73036acb2f1706803a2b65.zip |
Add path filter to OCS Share API ?shared_with_me=true
This allows all clients to quickly get the share info for a given path.
Instead of returning everything and filtering it then manually on the
client side.
Diffstat (limited to 'apps/files_sharing/api/share20ocs.php')
-rw-r--r-- | apps/files_sharing/api/share20ocs.php | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/apps/files_sharing/api/share20ocs.php b/apps/files_sharing/api/share20ocs.php index 2dadc0888ec..8fe8991f9c9 100644 --- a/apps/files_sharing/api/share20ocs.php +++ b/apps/files_sharing/api/share20ocs.php @@ -329,9 +329,13 @@ class Share20OCS { return new \OC_OCS_Result($share); } - private function getSharedWithMe() { - $userShares = $this->shareManager->getSharedWith($this->currentUser, \OCP\Share::SHARE_TYPE_USER, -1, 0); - $groupShares = $this->shareManager->getSharedWith($this->currentUser, \OCP\Share::SHARE_TYPE_GROUP, -1, 0); + /** + * @param \OCP\Files\File|\OCP\Files\Folder $node + * @return \OC_OCS_Result + */ + private function getSharedWithMe($node = null) { + $userShares = $this->shareManager->getSharedWith($this->currentUser, \OCP\Share::SHARE_TYPE_USER, $node, -1, 0); + $groupShares = $this->shareManager->getSharedWith($this->currentUser, \OCP\Share::SHARE_TYPE_GROUP, $node, -1, 0); $shares = array_merge($userShares, $groupShares); @@ -390,10 +394,6 @@ class Share20OCS { $subfiles = $this->request->getParam('subfiles'); $path = $this->request->getParam('path', null); - if ($sharedWithMe === 'true') { - return $this->getSharedWithMe(); - } - if ($path !== null) { $userFolder = $this->rootFolder->getUserFolder($this->currentUser->getUID()); try { @@ -403,6 +403,10 @@ class Share20OCS { } } + if ($sharedWithMe === 'true') { + return $this->getSharedWithMe($path); + } + if ($subfiles === 'true') { return $this->getSharesInDir($path); } |