summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-05-23 21:18:31 +0200
committerBjörn Schießle <schiessle@owncloud.com>2013-05-23 21:18:31 +0200
commit7b07168c46d860583f112df4b25120be296b686d (patch)
tree290deb5f8bccf8d52603a351475310bf7333c275
parenta9ebf2aabe0297e2bd02a07018d6bac3b2de65c6 (diff)
downloadnextcloud-server-7b07168c46d860583f112df4b25120be296b686d.tar.gz
nextcloud-server-7b07168c46d860583f112df4b25120be296b686d.zip
code clean up; nicer solution to solve the public link share problem if a user is logged in
-rwxr-xr-xapps/files_encryption/lib/keymanager.php18
-rw-r--r--apps/files_encryption/lib/util.php13
2 files changed, 6 insertions, 25 deletions
diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php
index 58c1d4b24ad..a8cbc19d401 100755
--- a/apps/files_encryption/lib/keymanager.php
+++ b/apps/files_encryption/lib/keymanager.php
@@ -238,14 +238,10 @@ class Keymanager
$util = new Util($view, \OCP\User::getUser());
- if ($util->isPublic()) {
- $keyfilePath = $util->getKeyfilePath() . $filePath . '.key';
- } else {
- list($owner, $filename) = $util->getUidAndFilename($filePath);
- $filePath_f = ltrim($filename, '/');
+ list($owner, $filename) = $util->getUidAndFilename($filePath);
+ $filePath_f = ltrim($filename, '/');
- $keyfilePath = '/' . $owner . '/files_encryption/keyfiles/' . $filePath_f . '.key';
- }
+ $keyfilePath = '/' . $owner . '/files_encryption/keyfiles/' . $filePath_f . '.key';
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
@@ -452,12 +448,8 @@ class Keymanager
//here we need the currently logged in user, while userId can be a different user
$util = new Util($view, \OCP\User::getUser());
- if ($util->isPublic()) {
- $shareKeyPath = $util->getSharekeyPath() . $filePath . '.' . $userId . '.shareKey';
- } else {
- list($owner, $filename) = $util->getUidAndFilename($filePath);
- $shareKeyPath = \OC\Files\Filesystem::normalizePath('/' . $owner . '/files_encryption/share-keys/' . $filename . '.' . $userId . '.shareKey');
- }
+ list($owner, $filename) = $util->getUidAndFilename($filePath);
+ $shareKeyPath = \OC\Files\Filesystem::normalizePath('/' . $owner . '/files_encryption/share-keys/' . $filename . '.' . $userId . '.shareKey');
if ($view->file_exists($shareKeyPath)) {
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index e327c3403bb..d42fe9953b5 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -1139,7 +1139,7 @@ class Util
$fileOwnerUid = $view->getOwner($path);
// handle public access
- if ($fileOwnerUid === false && $this->isPublic) {
+ if ($this->isPublic) {
$filename = $path;
$fileOwnerUid = $GLOBALS['fileOwner'];
@@ -1494,15 +1494,4 @@ class Util
$this->recoverAllFiles('/', $privateKey);
}
- public function isPublic() {
- return $this->isPublic;
- }
-
- public function getKeyfilePath() {
- return $this->keyfilesPath;
- }
-
- public function getSharekeyPath() {
- return $this->shareKeysPath;
- }
}