aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/api
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-01-13 13:02:23 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-01-13 16:35:15 +0100
commitcbd3050f4c5d0c98cc627cfab5d1ab8b85f1ae7c (patch)
tree50e58fd40b41fc11f4d669591b9d816fe0e06716 /apps/files_sharing/api
parent67b7ebccd134d68329fae201669924118a4d98fc (diff)
downloadnextcloud-server-cbd3050f4c5d0c98cc627cfab5d1ab8b85f1ae7c.tar.gz
nextcloud-server-cbd3050f4c5d0c98cc627cfab5d1ab8b85f1ae7c.zip
[Share 2.0] Use full share id (providerId:shareId)
Now that we support multiple managers we communicate shares to the outside as 'providerId:shareId'. This makes sures that id's are unique when references from the OCS API. However, since we do not want to break the OCS API v1 we need to somewhat hack around this. When we switch to OCS API v2 (which we should when we support more custom providers). We will change the id to always be the fullShareId.
Diffstat (limited to 'apps/files_sharing/api')
-rw-r--r--apps/files_sharing/api/share20ocs.php31
1 files changed, 21 insertions, 10 deletions
diff --git a/apps/files_sharing/api/share20ocs.php b/apps/files_sharing/api/share20ocs.php
index f81eb071a37..c698dccefb8 100644
--- a/apps/files_sharing/api/share20ocs.php
+++ b/apps/files_sharing/api/share20ocs.php
@@ -142,10 +142,20 @@ class Share20OCS {
* @return \OC_OCS_Result
*/
public function getShare($id) {
+ // Try both our default, and our federated provider..
+ $share = null;
+
+ // First check if it is an internal share.
try {
- $share = $this->shareManager->getShareById($id);
+ $share = $this->shareManager->getShareById('ocinternal:'.$id);
} catch (\OC\Share20\Exception\ShareNotFound $e) {
- return new \OC_OCS_Result(null, 404, 'wrong share ID, share doesn\'t exist.');
+ // Ignore for now
+ //return new \OC_OCS_Result(null, 404, 'wrong share ID, share doesn\'t exist.');
+ }
+
+ if ($share === null) {
+ //For now federated shares are handled by the old endpoint.
+ return \OCA\Files_Sharing\API\Local::getShare(['id' => $id]);
}
if ($this->canAccessShare($share)) {
@@ -163,18 +173,19 @@ class Share20OCS {
* @return \OC_OCS_Result
*/
public function deleteShare($id) {
+ // Try both our default and our federated provider
+ $share = null;
+
try {
- $share = $this->shareManager->getShareById($id);
+ $share = $this->shareManager->getShareById('ocinternal:' . $id);
} catch (\OC\Share20\Exception\ShareNotFound $e) {
- return new \OC_OCS_Result(null, 404, 'wrong share ID, share doesn\'t exist.');
+ //Ignore for now
+ //return new \OC_OCS_Result(null, 404, 'wrong share ID, share doesn\'t exist.');
}
- /*
- * FIXME
- * User the old code path for remote shares until we have our remoteshareprovider
- */
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) {
- \OCA\Files_Sharing\API\Local::deleteShare(['id' => $id]);
+ // Could not find the share as internal share... maybe it is a federated share
+ if ($share === null) {
+ return \OCA\Files_Sharing\API\Local::deleteShare(['id' => $id]);
}
if (!$this->canAccessShare($share)) {