summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/ajax
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2015-12-09 12:00:00 +0100
committerBjörn Schießle <bjoern@schiessle.org>2015-12-14 17:16:14 +0100
commitefc030aa25b047a7c9f720cf781f26cbe1d274e0 (patch)
treec5fb0f9eb12ec53a9f9e20a3a6ede8841e64b25c /apps/files_sharing/ajax
parentdb41c4f4b5f27757838ba17c03f6f263b91af527 (diff)
downloadnextcloud-server-efc030aa25b047a7c9f720cf781f26cbe1d274e0.tar.gz
nextcloud-server-efc030aa25b047a7c9f720cf781f26cbe1d274e0.zip
don't allow to create a federated share if source and target server are the same
Diffstat (limited to 'apps/files_sharing/ajax')
-rw-r--r--apps/files_sharing/ajax/external.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/files_sharing/ajax/external.php b/apps/files_sharing/ajax/external.php
index 0f8a3d56cf0..65861ac6a04 100644
--- a/apps/files_sharing/ajax/external.php
+++ b/apps/files_sharing/ajax/external.php
@@ -49,6 +49,14 @@ if(!\OCP\Util::isValidFileName($name)) {
exit();
}
+$currentUser = \OC::$server->getUserSession()->getUser()->getUID();
+$currentServer = \OC::$server->getURLGenerator()->getAbsoluteURL('/');
+if (\OC\Share\Helper::isSameUserOnSameServer($owner, $remote, $currentUser, $currentServer )) {
+ \OCP\JSON::error(array('data' => array('message' => $l->t('Not allowed to create a federated share with the same user server'))));
+ exit();
+}
+
+
$externalManager = new \OCA\Files_Sharing\External\Manager(
\OC::$server->getDatabaseConnection(),
\OC\Files\Filesystem::getMountManager(),