]> source.dussan.org Git - nextcloud-server.git/commitdiff
code clean up; nicer solution to solve the public link share problem if a user is...
authorBjörn Schießle <schiessle@owncloud.com>
Thu, 23 May 2013 19:18:31 +0000 (21:18 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Thu, 23 May 2013 19:18:31 +0000 (21:18 +0200)
apps/files_encryption/lib/keymanager.php
apps/files_encryption/lib/util.php

index 58c1d4b24adf149ded83486160948dd39e189fba..a8cbc19d40135e73719241b616108b3e51360911 100755 (executable)
@@ -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)) {
 
index e327c3403bb17ce80b2c3f71a5bbba44ea0d01e8..d42fe9953b507873ccecd8a50bbf842067f58dd7 100644 (file)
@@ -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;
-       }
 }