Removing files_encryption left overs

This commit is contained in:
Thomas Müller 2015-03-30 22:10:04 +02:00
parent 99255ff3a9
commit 00338f9dca
12 changed files with 6 additions and 56 deletions

View File

@ -35,7 +35,6 @@ $util = new \OCA\Encryption\Util(
\OC::$server->getUserSession(), \OC::$server->getUserSession(),
\OC::$server->getConfig()); \OC::$server->getConfig());
$session = new \OCA\Files_Encryption\Session($view);
$session = \OC::$server->getSession(); $session = \OC::$server->getSession();
$privateKeySet = $session->get('privateKey') !== false; $privateKeySet = $session->get('privateKey') !== false;

View File

@ -7,7 +7,7 @@ script('core', 'multiselect');
<form id="encryption" class="section"> <form id="encryption" class="section">
<h2><?php p($l->t('ownCloud basic encryption module')); ?></h2> <h2><?php p($l->t('ownCloud basic encryption module')); ?></h2>
<?php if($_["initStatus"] === \OCA\Files_Encryption\Session::NOT_INITIALIZED): ?> <?php if(!$_["initStatus"]): ?>
<?php p($l->t("Encryption App is enabled but your keys are not initialized, please log-out and log-in again")); ?> <?php p($l->t("Encryption App is enabled but your keys are not initialized, please log-out and log-in again")); ?>
<?php else: ?> <?php else: ?>
<p id="encryptionSetRecoveryKey"> <p id="encryptionSetRecoveryKey">

View File

@ -5,7 +5,7 @@
<form id="encryption" class="section"> <form id="encryption" class="section">
<h2><?php p($l->t('ownCloud basic encryption module')); ?></h2> <h2><?php p($l->t('ownCloud basic encryption module')); ?></h2>
<?php if ( $_["initialized"] === \OCA\Files_Encryption\Session::NOT_INITIALIZED ): ?> <?php if ($_["initialized"] === \OCA\Files_Encryption\Session::NOT_INITIALIZED ): ?>
<?php p($l->t("Encryption App is enabled but your keys are not initialized, please log-out and log-in again")); ?> <?php p($l->t("Encryption App is enabled but your keys are not initialized, please log-out and log-in again")); ?>

View File

@ -86,10 +86,6 @@ $dirInfo = \OC\Files\Filesystem::getFileInfo('/', false);
$storageInfo=OC_Helper::getStorageInfo('/', $dirInfo); $storageInfo=OC_Helper::getStorageInfo('/', $dirInfo);
// if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code) // if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code)
$encryptionInitStatus = 2; $encryptionInitStatus = 2;
if (OC_App::isEnabled('files_encryption')) {
$session = new \OCA\Files_Encryption\Session(new \OC\Files\View('/'));
$encryptionInitStatus = $session->getInitialized();
}
$nav = new OCP\Template('files', 'appnavigation', ''); $nav = new OCP\Template('files', 'appnavigation', '');

View File

@ -45,7 +45,6 @@ abstract class TestCase extends \Test\TestCase {
const TEST_FILES_SHARING_API_GROUP1 = "test-share-group1"; const TEST_FILES_SHARING_API_GROUP1 = "test-share-group1";
public static $stateFilesEncryption;
public $filename; public $filename;
public $data; public $data;
/** /**
@ -58,12 +57,6 @@ abstract class TestCase extends \Test\TestCase {
public static function setUpBeforeClass() { public static function setUpBeforeClass() {
parent::setUpBeforeClass(); parent::setUpBeforeClass();
// remember files_encryption state
self::$stateFilesEncryption = \OC_App::isEnabled('files_encryption');
//we don't want to tests with app files_encryption enabled
\OC_App::disable('files_encryption');
// reset backend // reset backend
\OC_User::clearBackends(); \OC_User::clearBackends();
\OC_Group::clearBackends(); \OC_Group::clearBackends();
@ -100,8 +93,6 @@ abstract class TestCase extends \Test\TestCase {
$this->data = 'foobar'; $this->data = 'foobar';
$this->view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files'); $this->view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
$this->assertFalse(\OC_App::isEnabled('files_encryption'));
} }
protected function tearDown() { protected function tearDown() {
@ -120,13 +111,6 @@ abstract class TestCase extends \Test\TestCase {
// delete group // delete group
\OC_Group::deleteGroup(self::TEST_FILES_SHARING_API_GROUP1); \OC_Group::deleteGroup(self::TEST_FILES_SHARING_API_GROUP1);
// reset app files_encryption
if (self::$stateFilesEncryption) {
\OC_App::enable('files_encryption');
} else {
\OC_App::disable('files_encryption');
}
\OC_Util::tearDownFS(); \OC_Util::tearDownFS();
\OC_User::setUserId(''); \OC_User::setUserId('');
Filesystem::tearDown(); Filesystem::tearDown();

View File

@ -36,7 +36,6 @@ class Test_Trashbin extends \Test\TestCase {
private $trashRoot1; private $trashRoot1;
private $trashRoot2; private $trashRoot2;
private static $encryptionStatus;
private static $rememberRetentionObligation; private static $rememberRetentionObligation;
private static $rememberAutoExpire; private static $rememberAutoExpire;
@ -58,7 +57,6 @@ class Test_Trashbin extends \Test\TestCase {
\OCP\Util::connectHook('OC_Filesystem', 'setup', '\OC\Files\Storage\Shared', 'setup'); \OCP\Util::connectHook('OC_Filesystem', 'setup', '\OC\Files\Storage\Shared', 'setup');
//disable encryption //disable encryption
self::$encryptionStatus = \OC_App::isEnabled('files_encryption');
\OC_App::disable('files_encryption'); \OC_App::disable('files_encryption');
//configure trashbin //configure trashbin
@ -82,10 +80,6 @@ class Test_Trashbin extends \Test\TestCase {
// cleanup test user // cleanup test user
\OC_User::deleteUser(self::TEST_TRASHBIN_USER1); \OC_User::deleteUser(self::TEST_TRASHBIN_USER1);
if (self::$encryptionStatus === true) {
\OC_App::enable('files_encryption');
}
\OC_Config::setValue('trashbin_retention_obligation', self::$rememberRetentionObligation); \OC_Config::setValue('trashbin_retention_obligation', self::$rememberRetentionObligation);
\OC_Config::setValue('trashbin_auto_expire', self::$rememberAutoExpire); \OC_Config::setValue('trashbin_auto_expire', self::$rememberAutoExpire);

View File

@ -88,8 +88,8 @@ class Application extends App {
/** /**
* Core class wrappers * Core class wrappers
*/ */
$container->registerService('IsEncryptionEnabled', function() { $container->registerService('IsEncryptionEnabled', function(SimpleContainer $c) {
return \OC_App::isEnabled('files_encryption'); return $c->query('ServerContainer')->getEncryptionManager()->isEnabled();
}); });
$container->registerService('URLGenerator', function(SimpleContainer $c) { $container->registerService('URLGenerator', function(SimpleContainer $c) {
return $c->query('ServerContainer')->getURLGenerator(); return $c->query('ServerContainer')->getURLGenerator();

View File

@ -190,7 +190,7 @@ class File extends \OC\Connector\Sabre\Node implements \Sabre\DAV\IFile {
} else { } else {
try { try {
return $this->fileView->fopen(ltrim($this->path, '/'), 'rb'); return $this->fileView->fopen(ltrim($this->path, '/'), 'rb');
} catch (\OCA\Files_Encryption\Exception\EncryptionException $e) { } catch (\OCP\Encryption\Exception\EncryptionException $e) {
throw new \Sabre\DAV\Exception\Forbidden($e->getMessage()); throw new \Sabre\DAV\Exception\Forbidden($e->getMessage());
} catch (\OCP\Files\StorageNotAvailableException $e) { } catch (\OCP\Files\StorageNotAvailableException $e) {
throw new \Sabre\DAV\Exception\ServiceUnavailable("Failed to open file: ".$e->getMessage()); throw new \Sabre\DAV\Exception\ServiceUnavailable("Failed to open file: ".$e->getMessage());

View File

@ -122,7 +122,7 @@ class OC_Files {
if ($get_type === self::FILE) { if ($get_type === self::FILE) {
$zip = false; $zip = false;
if ($xsendfile && OC_App::isEnabled('files_encryption')) { if ($xsendfile && \OC::$server->getEncryptionManager()->isEnabled()) {
$xsendfile = false; $xsendfile = false;
} }
} else { } else {

View File

@ -41,12 +41,6 @@ class FileCache extends \Test_Cache {
\OC_FileProxy::clearProxies(); \OC_FileProxy::clearProxies();
\OC_Hook::clear('OC_Filesystem'); \OC_Hook::clear('OC_Filesystem');
//disabled atm
//enable only the encryption hook if needed
//if(OC_App::isEnabled('files_encryption')) {
// OC_FileProxy::register(new OC_FileProxy_Encryption());
//}
//set up temporary storage //set up temporary storage
$this->storage = \OC\Files\Filesystem::getStorage('/'); $this->storage = \OC\Files\Filesystem::getStorage('/');
\OC\Files\Filesystem::clearMounts(); \OC\Files\Filesystem::clearMounts();

View File

@ -37,12 +37,6 @@ class UserCache extends \Test_Cache {
\OC_FileProxy::clearProxies(); \OC_FileProxy::clearProxies();
\OC_Hook::clear('OC_Filesystem'); \OC_Hook::clear('OC_Filesystem');
//disabled atm
//enable only the encryption hook if needed
//if(OC_App::isEnabled('files_encryption')) {
// OC_FileProxy::register(new OC_FileProxy_Encryption());
//}
//set up temporary storage //set up temporary storage
$this->storage = \OC\Files\Filesystem::getStorage('/'); $this->storage = \OC\Files\Filesystem::getStorage('/');
\OC\Files\Filesystem::clearMounts(); \OC\Files\Filesystem::clearMounts();

View File

@ -22,8 +22,6 @@ class UpdaterLegacy extends \Test\TestCase {
*/ */
private $scanner; private $scanner;
private $stateFilesEncryption;
/** /**
* @var \OC\Files\Cache\Cache $cache * @var \OC\Files\Cache\Cache $cache
*/ */
@ -37,11 +35,6 @@ class UpdaterLegacy extends \Test\TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
// remember files_encryption state
$this->stateFilesEncryption = \OC_App::isEnabled('files_encryption');
// we want to tests with the encryption app disabled
\OC_App::disable('files_encryption');
$this->storage = new \OC\Files\Storage\Temporary(array()); $this->storage = new \OC\Files\Storage\Temporary(array());
$textData = "dummy file data\n"; $textData = "dummy file data\n";
$imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png'); $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');
@ -80,10 +73,6 @@ class UpdaterLegacy extends \Test\TestCase {
$this->assertTrue($result); $this->assertTrue($result);
Filesystem::tearDown(); Filesystem::tearDown();
Filesystem::mount($this->originalStorage, array(), '/'); Filesystem::mount($this->originalStorage, array(), '/');
// reset app files_encryption
if ($this->stateFilesEncryption) {
\OC_App::enable('files_encryption');
}
parent::tearDown(); parent::tearDown();
} }