summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-02-18 18:10:22 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2014-02-18 18:10:22 +0100
commit1e84d6b14b56a4df39550b590051c2bfff900a9c (patch)
tree02a9bae807f51544db88868918ae347c78b2fc05 /apps/files_encryption
parenta573fe7d769f5eea26f52b818eee11779090bb50 (diff)
parent181bbd4325ea2b21ff8ecca93eb5ac839d6a739d (diff)
downloadnextcloud-server-1e84d6b14b56a4df39550b590051c2bfff900a9c.tar.gz
nextcloud-server-1e84d6b14b56a4df39550b590051c2bfff900a9c.zip
Merge pull request #7190 from owncloud/appconfig-legacy-apps
Remove usage of legacy OC_Appconfig
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/ajax/adminrecovery.php2
-rwxr-xr-xapps/files_encryption/lib/helper.php9
-rw-r--r--apps/files_encryption/lib/session.php6
-rw-r--r--apps/files_encryption/lib/util.php12
-rw-r--r--apps/files_encryption/settings-admin.php2
-rw-r--r--apps/files_encryption/settings-personal.php2
-rwxr-xr-xapps/files_encryption/tests/share.php12
7 files changed, 26 insertions, 19 deletions
diff --git a/apps/files_encryption/ajax/adminrecovery.php b/apps/files_encryption/ajax/adminrecovery.php
index 6a0186d5a9b..61e43acc2c3 100644
--- a/apps/files_encryption/ajax/adminrecovery.php
+++ b/apps/files_encryption/ajax/adminrecovery.php
@@ -18,7 +18,7 @@ $l = OC_L10N::get('files_encryption');
$return = false;
// Enable recoveryAdmin
-$recoveryKeyId = OC_Appconfig::getValue('files_encryption', 'recoveryKeyId');
+$recoveryKeyId = \OC::$server->getAppConfig()->getValue('files_encryption', 'recoveryKeyId');
if (isset($_POST['adminEnableRecovery']) && $_POST['adminEnableRecovery'] === '1') {
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index bb06a57c714..74a3b96a944 100755
--- a/apps/files_encryption/lib/helper.php
+++ b/apps/files_encryption/lib/helper.php
@@ -111,10 +111,11 @@ class Helper {
public static function adminEnableRecovery($recoveryKeyId, $recoveryPassword) {
$view = new \OC\Files\View('/');
+ $appConfig = \OC::$server->getAppConfig();
if ($recoveryKeyId === null) {
$recoveryKeyId = 'recovery_' . substr(md5(time()), 0, 8);
- \OC_Appconfig::setValue('files_encryption', 'recoveryKeyId', $recoveryKeyId);
+ $appConfig->setValue('files_encryption', 'recoveryKeyId', $recoveryKeyId);
}
if (!$view->is_dir('/owncloud_private_key')) {
@@ -147,7 +148,7 @@ class Helper {
\OC_FileProxy::$enabled = true;
// Set recoveryAdmin as enabled
- \OC_Appconfig::setValue('files_encryption', 'recoveryAdminEnabled', 1);
+ $appConfig->setValue('files_encryption', 'recoveryAdminEnabled', 1);
$return = true;
@@ -155,7 +156,7 @@ class Helper {
$util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), \OCP\User::getUser());
$return = $util->checkRecoveryPassword($recoveryPassword);
if ($return) {
- \OC_Appconfig::setValue('files_encryption', 'recoveryAdminEnabled', 1);
+ $appConfig->setValue('files_encryption', 'recoveryAdminEnabled', 1);
}
}
@@ -218,7 +219,7 @@ class Helper {
if ($return) {
// Set recoveryAdmin as disabled
- \OC_Appconfig::setValue('files_encryption', 'recoveryAdminEnabled', 0);
+ \OC::$server->getAppConfig()->setValue('files_encryption', 'recoveryAdminEnabled', 0);
}
return $return;
diff --git a/apps/files_encryption/lib/session.php b/apps/files_encryption/lib/session.php
index 25f2198181f..324081beabb 100644
--- a/apps/files_encryption/lib/session.php
+++ b/apps/files_encryption/lib/session.php
@@ -51,11 +51,13 @@ class Session {
}
- $publicShareKeyId = \OC_Appconfig::getValue('files_encryption', 'publicShareKeyId');
+ $appConfig = \OC::$server->getAppConfig();
+
+ $publicShareKeyId = $appConfig->getValue('files_encryption', 'publicShareKeyId');
if ($publicShareKeyId === null) {
$publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8);
- \OC_Appconfig::setValue('files_encryption', 'publicShareKeyId', $publicShareKeyId);
+ $appConfig->setValue('files_encryption', 'publicShareKeyId', $publicShareKeyId);
}
if (
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index f3f69997f2c..a338f90c8be 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -63,8 +63,10 @@ class Util {
$this->client = $client;
$this->userId = $userId;
- $this->publicShareKeyId = \OC_Appconfig::getValue('files_encryption', 'publicShareKeyId');
- $this->recoveryKeyId = \OC_Appconfig::getValue('files_encryption', 'recoveryKeyId');
+ $appConfig = \OC::$server->getAppConfig();
+
+ $this->publicShareKeyId = $appConfig->getValue('files_encryption', 'publicShareKeyId');
+ $this->recoveryKeyId = $appConfig->getValue('files_encryption', 'recoveryKeyId');
$this->userDir = '/' . $this->userId;
$this->fileFolderName = 'files';
@@ -1125,9 +1127,11 @@ class Util {
*/
public function getSharingUsersArray($sharingEnabled, $filePath, $currentUserId = false) {
+ $appConfig = \OC::$server->getAppConfig();
+
// Check if key recovery is enabled
if (
- \OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled')
+ $appConfig->getValue('files_encryption', 'recoveryAdminEnabled')
&& $this->recoveryEnabledForUser()
) {
$recoveryEnabled = true;
@@ -1156,7 +1160,7 @@ class Util {
// Admin UID to list of users to share to
if ($recoveryEnabled) {
// Find recoveryAdmin user ID
- $recoveryKeyId = \OC_Appconfig::getValue('files_encryption', 'recoveryKeyId');
+ $recoveryKeyId = $appConfig->getValue('files_encryption', 'recoveryKeyId');
// Add recoveryAdmin to list of users sharing
$userIds[] = $recoveryKeyId;
}
diff --git a/apps/files_encryption/settings-admin.php b/apps/files_encryption/settings-admin.php
index 9ad9bfb8877..88e06613997 100644
--- a/apps/files_encryption/settings-admin.php
+++ b/apps/files_encryption/settings-admin.php
@@ -11,7 +11,7 @@
$tmpl = new OCP\Template('files_encryption', 'settings-admin');
// Check if an adminRecovery account is enabled for recovering files after lost pwd
-$recoveryAdminEnabled = OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled', '0');
+$recoveryAdminEnabled = \OC::$server->getAppConfig()->getValue('files_encryption', 'recoveryAdminEnabled', '0');
$tmpl->assign('recoveryEnabled', $recoveryAdminEnabled);
diff --git a/apps/files_encryption/settings-personal.php b/apps/files_encryption/settings-personal.php
index ffcb99602e2..09e9df05352 100644
--- a/apps/files_encryption/settings-personal.php
+++ b/apps/files_encryption/settings-personal.php
@@ -20,7 +20,7 @@ $privateKeySet = $session->getPrivateKey() !== false;
// did we tried to initialize the keys for this session?
$initialized = $session->getInitialized();
-$recoveryAdminEnabled = OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled');
+$recoveryAdminEnabled = \OC::$server->getAppConfig()->getValue('files_encryption', 'recoveryAdminEnabled');
$recoveryEnabledForUser = $util->recoveryEnabledForUser();
$result = false;
diff --git a/apps/files_encryption/tests/share.php b/apps/files_encryption/tests/share.php
index 5c6569f20e7..46a21dd55cd 100755
--- a/apps/files_encryption/tests/share.php
+++ b/apps/files_encryption/tests/share.php
@@ -61,7 +61,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase {
\OC_User::useBackend('database');
// enable resharing
- \OC_Appconfig::setValue('core', 'shareapi_allow_resharing', 'yes');
+ \OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', 'yes');
// clear share hooks
\OC_Hook::clear('OCP\\Share');
@@ -531,7 +531,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase {
// login as admin
\Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
- $publicShareKeyId = \OC_Appconfig::getValue('files_encryption', 'publicShareKeyId');
+ $publicShareKeyId = \OC::$server->getAppConfig()->getValue('files_encryption', 'publicShareKeyId');
// check if share key for public exists
$this->assertTrue($this->view->file_exists(
@@ -662,7 +662,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase {
\Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
\OCA\Encryption\Helper::adminEnableRecovery(null, 'test123');
- $recoveryKeyId = OC_Appconfig::getValue('files_encryption', 'recoveryKeyId');
+ $recoveryKeyId = \OC::$server->getAppConfig()->getValue('files_encryption', 'recoveryKeyId');
// login as admin
\Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
@@ -755,7 +755,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase {
$this->assertTrue(\OCA\Encryption\Helper::adminEnableRecovery(null, 'test123'));
$this->assertTrue(\OCA\Encryption\Helper::adminDisableRecovery('test123'));
- $this->assertEquals(0, \OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled'));
+ $this->assertEquals(0, \OC::$server->getAppConfig()->getValue('files_encryption', 'recoveryAdminEnabled'));
}
/**
@@ -769,7 +769,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase {
$result = \OCA\Encryption\Helper::adminEnableRecovery(null, 'test123');
$this->assertTrue($result);
- $recoveryKeyId = OC_Appconfig::getValue('files_encryption', 'recoveryKeyId');
+ $recoveryKeyId = \OC::$server->getAppConfig()->getValue('files_encryption', 'recoveryKeyId');
// login as user2
\Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2);
@@ -863,7 +863,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase {
$this->assertTrue($util->setRecoveryForUser(0));
\OCA\Encryption\Helper::adminDisableRecovery('test123');
- $this->assertEquals(0, \OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled'));
+ $this->assertEquals(0, \OC::$server->getAppConfig()->getValue('files_encryption', 'recoveryAdminEnabled'));
}
/**