From 39c717b24cd4551a78d07256e15b29e52841f49b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= <schiessle@owncloud.com> Date: Thu, 18 Apr 2013 17:52:27 +0200 Subject: [PATCH] some fixes to the keymanager class to identify the file owner and the owner path correctly. --- apps/files_encryption/lib/keymanager.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php index 52d100055e..5c5a6c7ec5 100755 --- a/apps/files_encryption/lib/keymanager.php +++ b/apps/files_encryption/lib/keymanager.php @@ -108,7 +108,8 @@ class Keymanager { \OC_FileProxy::$enabled = false; - $util = new Util($view, $userId); + //here we need the currently logged in user, while userId can be a different user + $util = new Util($view, \OCP\User::getUser()); list($owner, $filename) = $util->getUidAndFilename($path); $basePath = '/' . $owner . '/files_encryption/keyfiles'; @@ -168,7 +169,7 @@ class Keymanager { */ public static function getFileKey( \OC_FilesystemView $view, $userId, $filePath ) { - $util = new Util($view, $userId); + $util = new Util($view, \OCP\User::getUser()); list($owner, $filename) = $util->getUidAndFilename($filePath); $filePath_f = ltrim( $filename, '/' ); @@ -298,7 +299,8 @@ class Keymanager { */ public static function setShareKey( \OC_FilesystemView $view, $path, $userId, $shareKey ) { - $util = new Util( $view, $userId ); + //here we need the currently logged in user, while userId can be a different user + $util = new Util( $view, \OCP\User::getUser() ); list($owner, $filename) = $util->getUidAndFilename($path); @@ -368,7 +370,8 @@ class Keymanager { \OC_FileProxy::$enabled = false; - $util = new Util( $view, $userId ); + //here we need the currently logged in user, while userId can be a different user + $util = new Util( $view, \OCP\User::getUser() ); list($owner, $filename) = $util->getUidAndFilename($filePath); -- GitLab