diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-08-27 20:05:51 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-08-27 20:37:38 -0400 |
commit | 2aac6f02a0dd3da73db09e1b23aa14cb84d4d88e (patch) | |
tree | 3c4a00793fd6e2618bb3b4eec506ee0ed9b12676 /core/ajax | |
parent | 0ad16e84c5f208d94f1f41447db3a23949942d45 (diff) | |
download | nextcloud-server-2aac6f02a0dd3da73db09e1b23aa14cb84d4d88e.tar.gz nextcloud-server-2aac6f02a0dd3da73db09e1b23aa14cb84d4d88e.zip |
Reimplement links support for sharing and add password protection option
Diffstat (limited to 'core/ajax')
-rw-r--r-- | core/ajax/share.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index 806ca9fb98f..debdf612c0e 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -26,8 +26,12 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo case 'share': if (isset($_POST['shareType']) && isset($_POST['shareWith']) && isset($_POST['permissions'])) { try { - OCP\Share::shareItem($_POST['itemType'], $_POST['itemSource'], (int)$_POST['shareType'], $_POST['shareWith'], $_POST['permissions']); - // TODO May need to return private link + if ((int)$_POST['shareType'] === OCP\Share::SHARE_TYPE_LINK && $_POST['shareWith'] == '') { + $shareWith = null; + } else { + $shareWith = $_POST['shareWith']; + } + 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()))); @@ -36,7 +40,12 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo break; case 'unshare': if (isset($_POST['shareType']) && isset($_POST['shareWith'])) { - $return = OCP\Share::unshare($_POST['itemType'], $_POST['itemSource'], $_POST['shareType'], $_POST['shareWith']); + if ((int)$_POST['shareType'] === OCP\Share::SHARE_TYPE_LINK && $_POST['shareWith'] == '') { + $shareWith = null; + } else { + $shareWith = $_POST['shareWith']; + } + $return = OCP\Share::unshare($_POST['itemType'], $_POST['itemSource'], $_POST['shareType'], $shareWith); ($return) ? OC_JSON::success() : OC_JSON::error(); } break; |