diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-13 15:22:18 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-22 10:43:44 +0200 |
commit | 12338e0ef07c409156fa9cd1008bb981bda20461 (patch) | |
tree | fe859814a2321ab98f498a623db39dab892b8153 /lib/private/share/share.php | |
parent | 14a953fbe01a3d26e1330ea224ab71928a2f93c1 (diff) | |
download | nextcloud-server-12338e0ef07c409156fa9cd1008bb981bda20461.tar.gz nextcloud-server-12338e0ef07c409156fa9cd1008bb981bda20461.zip |
allow admin to disable sharing for specific groups of users
Diffstat (limited to 'lib/private/share/share.php')
-rw-r--r-- | lib/private/share/share.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 16bc492d383..46796c26370 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -485,15 +485,23 @@ class Share extends \OC\Share\Constants { $itemSourceName = $itemSource; } - // verify that the file exists before we try to share it + // check if file can be shared if ($itemType === 'file' or $itemType === 'folder') { $path = \OC\Files\Filesystem::getPath($itemSource); + // verify that the file exists before we try to share it if (!$path) { $message = 'Sharing %s failed, because the file does not exist'; $message_t = $l->t('Sharing %s failed, because the file does not exist', array($itemSourceName)); \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR); throw new \Exception($message_t); } + // verify that the user has share permission + if (!\OC\Files\Filesystem::isSharable($path)) { + $message = 'You are not allowed to share %s'; + $message_t = $l->t('You are not allowed to share %s', array($itemSourceName)); + \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR); + throw new \Exception($message_t); + } } //verify that we don't share a folder which already contains a share mount point |