[Pkg-owncloud-commits] [owncloud] 20/239: make sure that we always use the correct user id
David Prévot
taffit at moszumanska.debian.org
Fri Nov 29 01:32:12 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit b9c18d16fe67f71015d1a233e2716bc7c0812140
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date: Wed Nov 20 23:23:23 2013 +0100
make sure that we always use the correct user id
---
apps/files_encryption/lib/keymanager.php | 18 +++++++++++-------
apps/files_encryption/lib/stream.php | 12 +++++++++---
apps/files_encryption/lib/util.php | 2 +-
3 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php
index 8d3e72b..b207b14 100755
--- a/apps/files_encryption/lib/keymanager.php
+++ b/apps/files_encryption/lib/keymanager.php
@@ -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);
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index 393c133..2497e56 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -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);
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index ce3d253..1e8b852 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -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 =
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list