summaryrefslogtreecommitdiffstats
path: root/core/ajax
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-27 20:05:51 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-27 20:37:38 -0400
commit2aac6f02a0dd3da73db09e1b23aa14cb84d4d88e (patch)
tree3c4a00793fd6e2618bb3b4eec506ee0ed9b12676 /core/ajax
parent0ad16e84c5f208d94f1f41447db3a23949942d45 (diff)
downloadnextcloud-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.php15
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;