make sure that we always use the correct user id
This commit is contained in:
parent
e11afd3066
commit
b9c18d16fe
3 changed files with 21 additions and 11 deletions
|
@ -125,8 +125,8 @@ class Keymanager {
|
|||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
//here we need the currently logged in user, while userId can be a different user
|
||||
$util = new Util($view, \OCP\User::getUser());
|
||||
$userId = Helper::getUser($path);
|
||||
$util = new Util($view, $userId);
|
||||
list($owner, $filename) = $util->getUidAndFilename($path);
|
||||
|
||||
// in case of system wide mount points the keys are stored directly in the data directory
|
||||
|
@ -225,7 +225,8 @@ class Keymanager {
|
|||
|
||||
$trimmed = ltrim($path, '/');
|
||||
|
||||
$util = new Util($view, \OCP\User::getUser());
|
||||
$userId = Helper::getUser($path);
|
||||
$util = new Util($view, $userId);
|
||||
|
||||
if($util->isSystemWideMountPoint($path)) {
|
||||
$keyPath = '/files_encryption/keyfiles/' . $trimmed;
|
||||
|
@ -322,8 +323,10 @@ class Keymanager {
|
|||
|
||||
// $shareKeys must be an array with the following format:
|
||||
// [userId] => [encrypted key]
|
||||
// Here we need the currently logged in user, while userId can be a different user
|
||||
$util = new Util($view, \OCP\User::getUser());
|
||||
|
||||
$userId = Helper::getUser($path);
|
||||
|
||||
$util = new Util($view, $userId);
|
||||
|
||||
list($owner, $filename) = $util->getUidAndFilename($path);
|
||||
|
||||
|
@ -441,8 +444,9 @@ class Keymanager {
|
|||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
//here we need the currently logged in user, while userId can be a different user
|
||||
$util = new Util($view, \OCP\User::getUser());
|
||||
$userId = Helper::getUser($filePath);
|
||||
|
||||
$util = new Util($view, $userId);
|
||||
|
||||
list($owner, $filename) = $util->getUidAndFilename($filePath);
|
||||
|
||||
|
|
|
@ -92,10 +92,14 @@ class Stream {
|
|||
|
||||
$this->session = new \OCA\Encryption\Session($this->rootView);
|
||||
|
||||
$this->privateKey = $this->session->getPrivateKey($this->userId);
|
||||
$this->privateKey = $this->session->getPrivateKey();
|
||||
|
||||
$util = new Util($this->rootView, \OCP\USER::getUser());
|
||||
$userId = Helper::getUser($path);
|
||||
|
||||
$util = new Util($this->rootView, $userId);
|
||||
|
||||
// need to get the userId once more from util, because now this can be the
|
||||
// public share key ID
|
||||
$this->userId = $util->getUserId();
|
||||
|
||||
// rawPath is relative to the data directory
|
||||
|
@ -509,7 +513,9 @@ class Stream {
|
|||
// Check if OC sharing api is enabled
|
||||
$sharingEnabled = \OCP\Share::isEnabled();
|
||||
|
||||
$util = new Util($this->rootView, $this->userId);
|
||||
$userId = Helper::getUser($this->rawPath);
|
||||
|
||||
$util = new Util($this->rootView, $userId);
|
||||
|
||||
// Get all users sharing the file includes current user
|
||||
$uniqueUserIds = $util->getSharingUsersArray($sharingEnabled, $this->relPath, $this->userId);
|
||||
|
|
|
@ -69,7 +69,7 @@ class Util {
|
|||
$this->userFilesDir =
|
||||
'/' . $userId . '/' . $this->fileFolderName; // TODO: Does this need to be user configurable?
|
||||
$this->publicKeyDir = '/' . 'public-keys';
|
||||
$this->encryptionDir = '/' . $this->userId . '/' . 'files_encryption';
|
||||
$this->encryptionDir = '/' . $userId . '/' . 'files_encryption';
|
||||
$this->keyfilesPath = $this->encryptionDir . '/' . 'keyfiles';
|
||||
$this->shareKeysPath = $this->encryptionDir . '/' . 'share-keys';
|
||||
$this->publicKeyPath =
|
||||
|
|
Loading…
Reference in a new issue