fix lib/private/encryption/util.php call

This commit is contained in:
Bjoern Schiessle 2015-03-30 10:37:31 +02:00 committed by Thomas Müller
parent 48fc3f3afe
commit 937efe856d
3 changed files with 23 additions and 14 deletions

View File

@ -704,17 +704,20 @@ class OC {
$enabled = self::$server->getEncryptionManager()->isEnabled(); $enabled = self::$server->getEncryptionManager()->isEnabled();
if ($enabled) { if ($enabled) {
\OC\Files\Filesystem::addStorageWrapper('oc_encryption', function ($mountPoint, $storage, \OCP\Files\Mount\IMountPoint $mount) { \OC\Files\Filesystem::addStorageWrapper('oc_encryption', function ($mountPoint, $storage, \OCP\Files\Mount\IMountPoint $mount) {
if($mount->getOption('encrypt', true)) {
$parameters = array('storage' => $storage, 'mountPoint' => $mountPoint); $parameters = [
$manager = \OC::$server->getEncryptionManager(); 'storage' => $storage,
$util = new \OC\Encryption\Util(new \OC\Files\View(), \OC::$server->getUserManager()); 'mountPoint' => $mountPoint,
$user = \OC::$server->getUserSession()->getUser(); 'mount' => $mount];
$logger = \OC::$server->getLogger(); $manager = \OC::$server->getEncryptionManager();
$uid = $user ? $user->getUID() : null; $util = new \OC\Encryption\Util(
return new \OC\Files\Storage\Wrapper\Encryption($parameters, $manager, $util, $logger, $uid); new \OC\Files\View(),
} else { \OC::$server->getUserManager(),
return $storage; \OC::$server->getConfig());
} $user = \OC::$server->getUserSession()->getUser();
$logger = \OC::$server->getLogger();
$uid = $user ? $user->getUID() : null;
return new \OC\Files\Storage\Wrapper\Encryption($parameters, $manager, $util, $logger, $uid);
}); });
} }
@ -730,7 +733,10 @@ class OC {
} }
$updater = new \OC\Encryption\Update( $updater = new \OC\Encryption\Update(
new \OC\Files\View(), new \OC\Files\View(),
new \OC\Encryption\Util(new \OC\Files\View(), \OC::$server->getUserManager()), new \OC\Encryption\Util(
new \OC\Files\View(),
\OC::$server->getUserManager(),
\OC::$server->getConfig()),
\OC\Files\Filesystem::getMountManager(), \OC\Files\Filesystem::getMountManager(),
\OC::$server->getEncryptionManager(), \OC::$server->getEncryptionManager(),
$uid $uid

View File

@ -66,7 +66,10 @@ class Util {
protected $excludedPaths; protected $excludedPaths;
/** /**
* @param \OC\Files\View $view root view *
* @param \OC\Files\View $view
* @param \OC\User\Manager $userManager
* @param IConfig $config
*/ */
public function __construct( public function __construct(
\OC\Files\View $view, \OC\Files\View $view,

View File

@ -414,7 +414,7 @@ class Server extends SimpleContainer implements IServerContainer {
*/ */
function getEncryptionKeyStorage($encryptionModuleId) { function getEncryptionKeyStorage($encryptionModuleId) {
$view = new \OC\Files\View(); $view = new \OC\Files\View();
$util = new \OC\Encryption\Util($view, \OC::$server->getUserManager()); $util = new \OC\Encryption\Util($view, \OC::$server->getUserManager(), \OC::$server->getConfig());
return $this->query('EncryptionKeyStorageFactory')->get($encryptionModuleId, $view, $util); return $this->query('EncryptionKeyStorageFactory')->get($encryptionModuleId, $view, $util);
} }