summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/api.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-03-10 11:16:09 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2014-03-10 11:35:54 +0100
commit9548670da76b15ca4e44df63304a11364dde44a0 (patch)
treed353e7831482803f3a7927a4d74d556abfed2cdf /apps/files_sharing/lib/api.php
parent536c33895f3e721492e30b19e02e4f1889207d34 (diff)
downloadnextcloud-server-9548670da76b15ca4e44df63304a11364dde44a0.tar.gz
nextcloud-server-9548670da76b15ca4e44df63304a11364dde44a0.zip
we need the file_source to delete a share successfully
Diffstat (limited to 'apps/files_sharing/lib/api.php')
-rw-r--r--apps/files_sharing/lib/api.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php
index 0ba58aa896a..dc95a791d29 100644
--- a/apps/files_sharing/lib/api.php
+++ b/apps/files_sharing/lib/api.php
@@ -68,7 +68,7 @@ class Api {
public static function getShare($params) {
$s = self::getShareFromId($params['id']);
- $params['itemSource'] = $s['item_source'];
+ $params['itemSource'] = $s['file_source'];
$params['itemType'] = $s['item_type'];
$params['specificShare'] = true;
@@ -281,9 +281,8 @@ class Api {
public static function updateShare($params) {
$share = self::getShareFromId($params['id']);
- $itemSource = isset($share['item_source']) ? $share['item_source'] : null;
- if($itemSource === null) {
+ if(!isset($share['file_source'])) {
return new \OC_OCS_Result(null, 404, "wrong share Id, share doesn't exist.");
}
@@ -431,10 +430,10 @@ class Api {
public static function deleteShare($params) {
$share = self::getShareFromId($params['id']);
- $itemSource = isset($share['item_source']) ? $share['item_source'] : null;
+ $fileSource = isset($share['file_source']) ? $share['file_source'] : null;
$itemType = isset($share['item_type']) ? $share['item_type'] : null;;
- if($itemSource === null) {
+ if($fileSource === null) {
return new \OC_OCS_Result(null, 404, "wrong share ID, share doesn't exist.");
}
@@ -448,7 +447,7 @@ class Api {
try {
$return = \OCP\Share::unshare(
$itemType,
- $itemSource,
+ $fileSource,
$shareType,
$shareWith);
} catch (\Exception $e) {
@@ -504,7 +503,7 @@ class Api {
* @return array with: item_source, share_type, share_with, item_type, permissions
*/
private static function getShareFromId($shareID) {
- $sql = 'SELECT `item_source`, `share_type`, `share_with`, `item_type`, `permissions` FROM `*PREFIX*share` WHERE `id` = ?';
+ $sql = 'SELECT `file_source`, `item_source`, `share_type`, `share_with`, `item_type`, `permissions` FROM `*PREFIX*share` WHERE `id` = ?';
$args = array($shareID);
$query = \OCP\DB::prepare($sql);
$result = $query->execute($args);