diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-12 12:19:07 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-16 17:41:09 +0200 |
commit | b6e14af861481d0b2ebf6ca752d994c5adfce866 (patch) | |
tree | 522434e1a85c90b7212a0c9ebed0174e24a11e8e /lib/private/share | |
parent | dab3cb65cf16d78796ce8dc23fa1f72aa9846b7e (diff) | |
download | nextcloud-server-b6e14af861481d0b2ebf6ca752d994c5adfce866.tar.gz nextcloud-server-b6e14af861481d0b2ebf6ca752d994c5adfce866.zip |
allow admin to enforce passwords for public link shares
Diffstat (limited to 'lib/private/share')
-rw-r--r-- | lib/private/share/share.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index a8537a916fb..440889ea6dc 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -588,7 +588,9 @@ class Share extends \OC\Share\Constants { $shareWith['users'] = array_diff(\OC_Group::usersInGroup($group), array($uidOwner)); } else if ($shareType === self::SHARE_TYPE_LINK) { if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') == 'yes') { + // when updating a link share + // FIXME Don't delete link if we update it if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_LINK, null, $uidOwner, self::FORMAT_NONE, null, 1)) { // remember old token @@ -599,7 +601,7 @@ class Share extends \OC\Share\Constants { } // Generate hash of password - same method as user passwords - if (isset($shareWith)) { + if (!empty($shareWith)) { $forcePortable = (CRYPT_BLOWFISH != 1); $hasher = new \PasswordHash(8, $forcePortable); $shareWith = $hasher->HashPassword($shareWith.\OC_Config::getValue('passwordsalt', '')); @@ -611,6 +613,13 @@ class Share extends \OC\Share\Constants { } } + if (\OCP\Util::isPublicLinkPasswordRequired() && empty($shareWith)) { + $message = 'You need to provide a password to create a public link, only protected links are allowed'; + $message_t = $l->t('You need to provide a password to create a public link, only protected links are allowed'); + \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR); + throw new \Exception($message_t); + } + // Generate token if (isset($oldToken)) { $token = $oldToken; |