summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/ajax/external.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-06-12 19:49:52 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-06-14 10:22:38 +0200
commit84a651e46deff5fe577ed564e5826ff24c18f9a5 (patch)
tree1b137ebc8b504180b7bfeed99590c8c751af07e9 /apps/files_sharing/ajax/external.php
parente7b58ed2bdfe4bb56866e76b8fdd618946fa3c51 (diff)
downloadnextcloud-server-84a651e46deff5fe577ed564e5826ff24c18f9a5.tar.gz
nextcloud-server-84a651e46deff5fe577ed564e5826ff24c18f9a5.zip
add settings to disable server to server sharing
Diffstat (limited to 'apps/files_sharing/ajax/external.php')
-rw-r--r--apps/files_sharing/ajax/external.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/files_sharing/ajax/external.php b/apps/files_sharing/ajax/external.php
index 3759559764d..5b4d4656d62 100644
--- a/apps/files_sharing/ajax/external.php
+++ b/apps/files_sharing/ajax/external.php
@@ -9,6 +9,14 @@
OCP\JSON::callCheck();
OCP\JSON::checkLoggedIn();
+$l = OC_L10N::get('files_sharing');
+
+// check if server admin allows to mount public links from other servers
+if (OCA\Files_Sharing\Helper::isIncomingServer2serverShareEnabled() === false) {
+ \OCP\JSON::error(array('data' => array('message' => $l->t('Server to server sharing is not enabled on this server'))));
+ exit();
+}
+
$token = $_POST['token'];
$remote = $_POST['remote'];
$owner = $_POST['owner'];
@@ -32,6 +40,8 @@ $storage = $mount->getStorage();
$result = $storage->file_exists('');
if($result){
$storage->getScanner()->scanAll();
+ \OCP\JSON::success();
+} else {
+ $externalManager->removeShare($mount->getMountPoint());
+ \OCP\JSON::error(array('data' => array('message' => $l->t("Couldn't add remote share"))));
}
-
-echo json_encode($result);