diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-22 13:09:42 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-22 13:09:42 +0200 |
commit | 225cde21830459db044d6564c7a9cf62b7dd5944 (patch) | |
tree | 7a56ae0dbb91895f191df3686267e55199672035 /lib | |
parent | 987bc138df89be2d0afdf268ab5c991b1bbe830b (diff) | |
download | nextcloud-server-225cde21830459db044d6564c7a9cf62b7dd5944.tar.gz nextcloud-server-225cde21830459db044d6564c7a9cf62b7dd5944.zip |
pass KeyStorage via ctor
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/encryption/manager.php | 3 | ||||
-rw-r--r-- | lib/private/files/storage/wrapper/encryption.php | 25 |
2 files changed, 11 insertions, 17 deletions
diff --git a/lib/private/encryption/manager.php b/lib/private/encryption/manager.php index 7a3f17519fc..97203b7756d 100644 --- a/lib/private/encryption/manager.php +++ b/lib/private/encryption/manager.php @@ -221,7 +221,8 @@ class Manager implements IManager { $logger = \OC::$server->getLogger(); $uid = $user ? $user->getUID() : null; $fileHelper = \OC::$server->getEncryptionFilesHelper(); - return new Encryption($parameters, $manager, $util, $logger, $fileHelper, $uid); + $keyStorage = \OC::$server->getEncryptionKeyStorage(); + return new Encryption($parameters, $manager, $util, $logger, $fileHelper, $uid, $keyStorage); } else { return $storage; } diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php index 04eb5fceedd..0a9e6d61d2e 100644 --- a/lib/private/files/storage/wrapper/encryption.php +++ b/lib/private/files/storage/wrapper/encryption.php @@ -56,6 +56,9 @@ class Encryption extends Wrapper { /** @var IMountPoint */ private $mount; + /** @var \OCP\Encryption\Keys\IStorage */ + private $keyStorage; + /** * @param array $parameters * @param \OC\Encryption\Manager $encryptionManager @@ -70,7 +73,8 @@ class Encryption extends Wrapper { \OC\Encryption\Util $util = null, \OC\Log $logger = null, File $fileHelper = null, - $uid = null + $uid = null, + $keyStorage = null ) { $this->mountPoint = $parameters['mountPoint']; @@ -80,6 +84,7 @@ class Encryption extends Wrapper { $this->logger = $logger; $this->uid = $uid; $this->fileHelper = $fileHelper; + $this->keyStorage = $keyStorage; $this->unencryptedSize = array(); parent::__construct($parameters); } @@ -187,8 +192,7 @@ class Encryption extends Wrapper { $encryptionModule = $this->getEncryptionModule($path); if ($encryptionModule) { - $keyStorage = $this->getKeyStorage(); - $keyStorage->deleteAllFileKeys($this->getFullPath($path), + $this->keyStorage->deleteAllFileKeys($this->getFullPath($path), $encryptionModule->getId()); } @@ -215,8 +219,7 @@ class Encryption extends Wrapper { if (isset($this->unencryptedSize[$source])) { $this->unencryptedSize[$target] = $this->unencryptedSize[$source]; } - $keyStorage = $this->getKeyStorage(); - $keyStorage->renameKeys($source, $target); + $this->keyStorage->renameKeys($source, $target); } return $result; @@ -241,8 +244,7 @@ class Encryption extends Wrapper { $target = $this->getFullPath($path2); $encryptionModule = $this->getEncryptionModule($path2); if ($encryptionModule) { - $keyStorage = $this->getKeyStorage($encryptionModule->getId()); - $keyStorage->copyKeys($source, $target); + $this->keyStorage->copyKeys($source, $target); } } @@ -429,13 +431,4 @@ class Encryption extends Wrapper { public function updateUnencryptedSize($path, $unencryptedSize) { $this->unencryptedSize[$path] = $unencryptedSize; } - - /** - * @param string $encryptionModuleId - * @return \OCP\Encryption\Keys\IStorage - */ - protected function getKeyStorage() { - return \OC::$server->getEncryptionKeyStorage(); - } - } |