diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2012-11-12 14:44:00 +0100 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2012-11-20 15:03:12 +0100 |
commit | d8a171df26a33710ad162b6acc9f46d00976b986 (patch) | |
tree | 958a8024bd6bf2d6ef9b1f6f80b01ec99763df87 /core/ajax | |
parent | 568def2b61e45d51d4506ad08723c3e2173481b4 (diff) | |
download | nextcloud-server-d8a171df26a33710ad162b6acc9f46d00976b986.tar.gz nextcloud-server-d8a171df26a33710ad162b6acc9f46d00976b986.zip |
implement share via link token
Diffstat (limited to 'core/ajax')
-rw-r--r-- | core/ajax/share.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index efe01dff886..41832a3c659 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -28,13 +28,19 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo case 'share': if (isset($_POST['shareType']) && isset($_POST['shareWith']) && isset($_POST['permissions'])) { try { - if ((int)$_POST['shareType'] === OCP\Share::SHARE_TYPE_LINK && $_POST['shareWith'] == '') { + $shareType = (int)$_POST['shareType']; + $shareWith = $_POST['shareWith']; + if ($shareType === OCP\Share::SHARE_TYPE_LINK && $shareWith == '') { $shareWith = null; + } + + $token = OCP\Share::shareItem($_POST['itemType'], $_POST['itemSource'], $shareType, $shareWith, $_POST['permissions']); + + if (is_string($token)) { + OC_JSON::success(array('data' => array('token' => $token))); } else { - $shareWith = $_POST['shareWith']; + OC_JSON::success(); } - OCP\Share::shareItem($_POST['itemType'], $_POST['itemSource'], (int)$_POST['shareType'], $shareWith, $_POST['permissions']); - OC_JSON::success(); } catch (Exception $exception) { OC_JSON::error(array('data' => array('message' => $exception->getMessage()))); } |