|
|
|
@ -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); |
|
|
|
|