always encrypt files to owner

This commit is contained in:
Bjoern Schiessle 2014-03-31 18:09:46 +02:00
parent 65e3f63400
commit 8e34812393
3 changed files with 11 additions and 13 deletions

View File

@ -545,7 +545,7 @@ class Stream {
$util = new Util($this->rootView, $this->userId); $util = new Util($this->rootView, $this->userId);
// Get all users sharing the file includes current user // Get all users sharing the file includes current user
$uniqueUserIds = $util->getSharingUsersArray($sharingEnabled, $this->relPath, $this->userId); $uniqueUserIds = $util->getSharingUsersArray($sharingEnabled, $this->relPath);
$checkedUserIds = $util->filterShareReadyUsers($uniqueUserIds); $checkedUserIds = $util->filterShareReadyUsers($uniqueUserIds);
// Fetch public keys for all sharing users // Fetch public keys for all sharing users

View File

@ -1124,8 +1124,9 @@ class Util {
* @brief Find, sanitise and format users sharing a file * @brief Find, sanitise and format users sharing a file
* @note This wraps other methods into a portable bundle * @note This wraps other methods into a portable bundle
* @param boolean $sharingEnabled * @param boolean $sharingEnabled
* @param string $filePath path relativ to current users files folder
*/ */
public function getSharingUsersArray($sharingEnabled, $filePath, $currentUserId = false) { public function getSharingUsersArray($sharingEnabled, $filePath) {
$appConfig = \OC::$server->getAppConfig(); $appConfig = \OC::$server->getAppConfig();
@ -1144,12 +1145,14 @@ class Util {
$ownerPath = \OCA\Encryption\Helper::stripPartialFileExtension($ownerPath); $ownerPath = \OCA\Encryption\Helper::stripPartialFileExtension($ownerPath);
$userIds = array(); // always add owner to the list of users with access to the file
$userIds = array($owner);
if ($sharingEnabled) { if ($sharingEnabled) {
// Find out who, if anyone, is sharing the file // Find out who, if anyone, is sharing the file
$result = \OCP\Share::getUsersSharingFile($ownerPath, $owner, true); $result = \OCP\Share::getUsersSharingFile($ownerPath, $owner);
$userIds = $result['users']; $userIds = \array_merge($userIds, $result['users']);
if ($result['public']) { if ($result['public']) {
$userIds[] = $this->publicShareKeyId; $userIds[] = $this->publicShareKeyId;
} }
@ -1165,11 +1168,6 @@ class Util {
$userIds[] = $recoveryKeyId; $userIds[] = $recoveryKeyId;
} }
// add current user if given
if ($currentUserId !== false) {
$userIds[] = $currentUserId;
}
// check if it is a group mount // check if it is a group mount
if (\OCP\App::isEnabled("files_external")) { if (\OCP\App::isEnabled("files_external")) {
$mount = \OC_Mount_Config::getSystemMountPoints(); $mount = \OC_Mount_Config::getSystemMountPoints();

View File

@ -63,9 +63,9 @@ class Share extends \OC\Share\Constants {
/** /**
* Find which users can access a shared item * Find which users can access a shared item
* @param $path to the file * @param string $path to the file
* @param $user owner of the file * @param string $user owner of the file
* @param include owner to the list of users with access to the file * @param bool $includeOwner include owner to the list of users with access to the file
* @return array * @return array
* @note $path needs to be relative to user data dir, e.g. 'file.txt' * @note $path needs to be relative to user data dir, e.g. 'file.txt'
* not '/admin/data/file.txt' * not '/admin/data/file.txt'