diff options
author | Björn Schießle <bjoern@schiessle.org> | 2015-12-09 12:00:00 +0100 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2015-12-14 17:16:14 +0100 |
commit | efc030aa25b047a7c9f720cf781f26cbe1d274e0 (patch) | |
tree | c5fb0f9eb12ec53a9f9e20a3a6ede8841e64b25c /apps/files_sharing/ajax | |
parent | db41c4f4b5f27757838ba17c03f6f263b91af527 (diff) | |
download | nextcloud-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.php | 8 |
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(), |