diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-09-18 11:49:02 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-09-18 11:49:02 +0200 |
commit | 1a60aa2b6a15ae68a2a6998a72580c171b88f719 (patch) | |
tree | 2c0bcab31958a6d950d741efad4ff60a7bd52b6c /lib/public | |
parent | e0f18ec72b5e1dd02ece60a77fef94c643e535b1 (diff) | |
download | nextcloud-server-1a60aa2b6a15ae68a2a6998a72580c171b88f719.tar.gz nextcloud-server-1a60aa2b6a15ae68a2a6998a72580c171b88f719.zip |
only remember password if the user changes the permissions, otherwise the user disabled the password protection
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/share.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/public/share.php b/lib/public/share.php index 9ab956d84b9..91c5c477c8d 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -106,22 +106,22 @@ class Share { } return false; } - + /** * @brief Prepare a path to be passed to DB as file_target * @return string Prepared path */ public static function prepFileTarget( $path ) { - + // Paths in DB are stored with leading slashes, so add one if necessary if ( substr( $path, 0, 1 ) !== '/' ) { - + $path = '/' . $path; - + } - + return $path; - + } /** @@ -256,7 +256,7 @@ class Share { return self::getItems($itemType, $itemTarget, self::$shareTypeUserAndGroups, \OC_User::getUser(), null, $format, $parameters, 1, $includeCollections); } - + /** * @brief Get the item of item type shared with the current user by source * @param string Item type @@ -450,6 +450,7 @@ class Share { $uidOwner, self::FORMAT_NONE, null, 1)) { // remember old token $oldToken = $checkExists['token']; + $oldPermissions = $checkExists['permissions']; //delete the old share self::delete($checkExists['id']); } @@ -460,8 +461,11 @@ class Share { $hasher = new \PasswordHash(8, $forcePortable); $shareWith = $hasher->HashPassword($shareWith.\OC_Config::getValue('passwordsalt', '')); } else { - // reuse the already set password - $shareWith = $checkExists['share_with']; + // reuse the already set password, but only if we change permissions + // otherwise the user disabled the password protection + if ($checkExists && (int)$permissions !== $oldPermissions) { + $shareWith = $checkExists['share_with']; + } } // Generate token |