summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-02-18 18:31:33 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2014-02-18 18:31:33 +0100
commitc6f4f85e27a10459422ab9789c894d13f0cd34c7 (patch)
tree6b4cf7a304242c5891952b428b3bca950924f309 /apps
parent9fac95c2ab46a734607657bbad6f164aaa61286f (diff)
parent8991e4505adba2dae8afe7b7941ec744bfe78712 (diff)
downloadnextcloud-server-c6f4f85e27a10459422ab9789c894d13f0cd34c7.tar.gz
nextcloud-server-c6f4f85e27a10459422ab9789c894d13f0cd34c7.zip
Merge branch 'master' into scrutinizer_documentation_patches
Conflicts: lib/private/migration/content.php
Diffstat (limited to 'apps')
-rw-r--r--apps/files/css/files.css2
-rw-r--r--apps/files/index.php8
-rw-r--r--apps/files_encryption/ajax/adminrecovery.php2
-rw-r--r--apps/files_encryption/ajax/getMigrationStatus.php8
-rw-r--r--apps/files_encryption/appinfo/app.php1
-rw-r--r--apps/files_encryption/hooks/hooks.php29
-rw-r--r--apps/files_encryption/js/detect-migration.js6
-rw-r--r--apps/files_encryption/js/encryption.js12
-rwxr-xr-xapps/files_encryption/lib/helper.php9
-rw-r--r--apps/files_encryption/lib/proxy.php2
-rw-r--r--apps/files_encryption/lib/session.php6
-rw-r--r--apps/files_encryption/lib/util.php103
-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
-rwxr-xr-xapps/files_encryption/tests/util.php81
-rw-r--r--apps/files_external/lib/google.php5
-rw-r--r--apps/files_sharing/css/public.css5
-rw-r--r--apps/files_sharing/lib/api.php6
-rw-r--r--apps/files_sharing/public.php6
-rw-r--r--apps/files_trashbin/lib/trashbin.php2
-rw-r--r--apps/files_versions/lib/versions.php2
-rw-r--r--apps/user_ldap/templates/part.wizard-groupfilter.php2
-rw-r--r--apps/user_ldap/templates/part.wizard-loginfilter.php2
-rw-r--r--apps/user_ldap/templates/part.wizard-userfilter.php2
25 files changed, 228 insertions, 89 deletions
diff --git a/apps/files/css/files.css b/apps/files/css/files.css
index 27fa75ebc59..3ad167054c2 100644
--- a/apps/files/css/files.css
+++ b/apps/files/css/files.css
@@ -319,7 +319,7 @@ a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; }
#fileList a.action {
display: inline;
margin: -8px 0;
- padding: 18px 8px !important;
+ padding: 18px 8px;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
diff --git a/apps/files/index.php b/apps/files/index.php
index dd63f29bc28..c9eea6a4174 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -79,6 +79,8 @@ if (\OC\Files\Cache\Upgrade::needUpgrade($user)) { //dont load anything if we ne
$needUpgrade = false;
}
+$config = \OC::$server->getConfig();
+
// Make breadcrumb
$breadcrumb = \OCA\Files\Helper::makeBreadcrumb($dir);
@@ -104,7 +106,7 @@ if ($needUpgrade) {
$freeSpace=$storageInfo['free'];
$uploadLimit=OCP\Util::uploadLimit();
$maxUploadFilesize=OCP\Util::maxUploadFilesize($dir);
- $publicUploadEnabled = \OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes');
+ $publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes');
// if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code)
$encryptionInitStatus = 2;
if (OC_App::isEnabled('files_encryption')) {
@@ -143,8 +145,8 @@ if ($needUpgrade) {
$tmpl->assign('isPublic', false);
$tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
$tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles());
- $tmpl->assign("mailNotificationEnabled", \OC_Appconfig::getValue('core', 'shareapi_allow_mail_notification', 'yes'));
- $tmpl->assign("allowShareWithLink", \OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes'));
+ $tmpl->assign("mailNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_mail_notification', 'yes'));
+ $tmpl->assign("allowShareWithLink", $config->getAppValue('core', 'shareapi_allow_links', 'yes'));
$tmpl->assign("encryptionInitStatus", $encryptionInitStatus);
$tmpl->assign('disableSharing', false);
$tmpl->assign('ajaxLoad', $ajaxLoad);
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/ajax/getMigrationStatus.php b/apps/files_encryption/ajax/getMigrationStatus.php
index 17469a1af0c..7c9e0dcc51c 100644
--- a/apps/files_encryption/ajax/getMigrationStatus.php
+++ b/apps/files_encryption/ajax/getMigrationStatus.php
@@ -13,16 +13,14 @@ use OCA\Encryption\Util;
$loginname = isset($_POST['user']) ? $_POST['user'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';
-$migrationCompleted = true;
+$migrationStatus = Util::MIGRATION_COMPLETED;
if ($loginname !== '' && $password !== '') {
$username = \OCP\User::checkPassword($loginname, $password);
if ($username) {
$util = new Util(new \OC_FilesystemView('/'), $username);
- if ($util->getMigrationStatus() !== Util::MIGRATION_COMPLETED) {
- $migrationCompleted = false;
- }
+ $migrationStatus = $util->getMigrationStatus();
}
}
-\OCP\JSON::success(array('data' => array('migrationCompleted' => $migrationCompleted)));
+\OCP\JSON::success(array('data' => array('migrationStatus' => $migrationStatus)));
diff --git a/apps/files_encryption/appinfo/app.php b/apps/files_encryption/appinfo/app.php
index fd9aa429b01..21de421c195 100644
--- a/apps/files_encryption/appinfo/app.php
+++ b/apps/files_encryption/appinfo/app.php
@@ -10,6 +10,7 @@ OC::$CLASSPATH['OCA\Encryption\Session'] = 'files_encryption/lib/session.php';
OC::$CLASSPATH['OCA\Encryption\Capabilities'] = 'files_encryption/lib/capabilities.php';
OC::$CLASSPATH['OCA\Encryption\Helper'] = 'files_encryption/lib/helper.php';
+\OCP\Util::addscript('files_encryption', 'encryption');
\OCP\Util::addscript('files_encryption', 'detect-migration');
if (!OC_Config::getValue('maintenance', false)) {
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index d2a8290156f..3af43f10264 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -85,10 +85,9 @@ class Hooks {
$ready = $util->beginMigration();
} elseif ($migrationStatus === Util::MIGRATION_IN_PROGRESS) {
// refuse login as long as the initial encryption is running
- while ($migrationStatus === Util::MIGRATION_IN_PROGRESS) {
- sleep(60);
- $migrationStatus = $util->getMigrationStatus();
- }
+ sleep(5);
+ \OCP\User::logout();
+ return false;
}
// If migration not yet done
@@ -109,21 +108,27 @@ class Hooks {
}
- // Encrypt existing user files:
- if (
- $util->encryptAll('/' . $params['uid'] . '/' . 'files', $session->getLegacyKey(), $params['password'])
- ) {
+ // Encrypt existing user files
+ try {
+ $result = $util->encryptAll('/' . $params['uid'] . '/' . 'files', $session->getLegacyKey(), $params['password']);
+ } catch (\Exception $ex) {
+ \OCP\Util::writeLog('Encryption library', 'Initial encryption failed! Error: ' . $ex->getMessage(), \OCP\Util::FATAL);
+ $util->resetMigrationStatus();
+ \OCP\User::logout();
+ $result = false;
+ }
+
+ if ($result) {
\OC_Log::write(
'Encryption library', 'Encryption of existing files belonging to "' . $params['uid'] . '" completed'
, \OC_Log::INFO
);
- }
-
- // Register successful migration in DB
- $util->finishMigration();
+ // Register successful migration in DB
+ $util->finishMigration();
+ }
}
return true;
diff --git a/apps/files_encryption/js/detect-migration.js b/apps/files_encryption/js/detect-migration.js
index 301e77f24f7..f5627edf4e4 100644
--- a/apps/files_encryption/js/detect-migration.js
+++ b/apps/files_encryption/js/detect-migration.js
@@ -17,10 +17,14 @@ $(document).ready(function(){
data: {user: user, password: password},
async: false,
success: function(response) {
- if (response.data.migrationCompleted === false) {
+ if (response.data.migrationStatus === OC.Encryption.MIGRATION_OPEN) {
var message = t('files_encryption', 'Initial encryption started... This can take some time. Please wait.');
$('#messageText').text(message);
$('#message').removeClass('hidden').addClass('update');
+ } else if (response.data.migrationStatus === OC.Encryption.MIGRATION_IN_PROGRESS) {
+ var message = t('files_encryption', 'Initial encryption running... Please try again later.');
+ $('#messageText').text(message);
+ $('#message').removeClass('hidden').addClass('update');
}
}
});
diff --git a/apps/files_encryption/js/encryption.js b/apps/files_encryption/js/encryption.js
new file mode 100644
index 00000000000..65ffabe55e6
--- /dev/null
+++ b/apps/files_encryption/js/encryption.js
@@ -0,0 +1,12 @@
+/**
+ * Copyright (c) 2014
+ * Bjoern Schiessle <schiessle@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or later.
+ * See the COPYING-README file.
+ */
+
+OC.Encryption={
+ MIGRATION_OPEN:0,
+ MIGRATION_COMPLETED:1,
+ MIGRATION_IN_PROGRESS:-1,
+};
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index 8cc6096edd2..5ec09629d62 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/proxy.php b/apps/files_encryption/lib/proxy.php
index 2ea477a6e4d..9d456f6c517 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -262,7 +262,7 @@ class Proxy extends \OC_FileProxy {
} elseif (
self::shouldEncrypt($path)
- and $meta ['mode'] !== 'r'
+ and $meta['mode'] !== 'r'
and $meta['mode'] !== 'rb'
) {
$result = fopen('crypt://' . $path, $meta['mode']);
diff --git a/apps/files_encryption/lib/session.php b/apps/files_encryption/lib/session.php
index ca36fa6e6d5..aa58e33e9d2 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 47f020ed29c..ec06bd52f5e 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';
@@ -316,7 +318,8 @@ class Util {
$found = array(
'plain' => array(),
'encrypted' => array(),
- 'legacy' => array()
+ 'legacy' => array(),
+ 'broken' => array(),
);
}
@@ -327,10 +330,7 @@ class Util {
if(is_resource($handle)) {
while (false !== ($file = readdir($handle))) {
- if (
- $file !== "."
- && $file !== ".."
- ) {
+ if ($file !== "." && $file !== "..") {
$filePath = $directory . '/' . $this->view->getRelativePath('/' . $file);
$relPath = \OCA\Encryption\Helper::stripUserFilesPath($filePath);
@@ -357,15 +357,23 @@ class Util {
// NOTE: This is inefficient;
// scanning every file like this
// will eat server resources :(
- if (
- Keymanager::getFileKey($this->view, $this, $relPath)
- && $isEncryptedPath
- ) {
-
- $found['encrypted'][] = array(
- 'name' => $file,
- 'path' => $filePath
- );
+ if ($isEncryptedPath) {
+
+ $fileKey = Keymanager::getFileKey($this->view, $this, $relPath);
+ $shareKey = Keymanager::getShareKey($this->view, $this->userId, $this, $relPath);
+ // if file is encrypted but now file key is available, throw exception
+ if ($fileKey === false || $shareKey === false) {
+ \OCP\Util::writeLog('encryption library', 'No keys available to decrypt the file: ' . $filePath, \OCP\Util::ERROR);
+ $found['broken'][] = array(
+ 'name' => $file,
+ 'path' => $filePath,
+ );
+ } else {
+ $found['encrypted'][] = array(
+ 'name' => $file,
+ 'path' => $filePath,
+ );
+ }
// If the file uses old
// encryption system
@@ -771,6 +779,12 @@ class Util {
$successful = false;
}
+ // if there are broken encrypted files than the complete decryption
+ // was not successful
+ if (!empty($found['broken'])) {
+ $successful = false;
+ }
+
if ($successful) {
$this->view->deleteAll($this->keyfilesPath);
$this->view->deleteAll($this->shareKeysPath);
@@ -1114,9 +1128,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;
@@ -1145,7 +1161,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;
}
@@ -1187,26 +1203,48 @@ class Util {
}
/**
- * @brief start migration mode to initially encrypt users data
+ * @brief set migration status
+ * @param int $status
* @return boolean
*/
- public function beginMigration() {
-
- $return = false;
+ private function setMigrationStatus($status) {
- $sql = 'UPDATE `*PREFIX*encryption` SET `migration_status` = ? WHERE `uid` = ? and `migration_status` = ?';
- $args = array(self::MIGRATION_IN_PROGRESS, $this->userId, self::MIGRATION_OPEN);
+ $sql = 'UPDATE `*PREFIX*encryption` SET `migration_status` = ? WHERE `uid` = ?';
+ $args = array($status, $this->userId);
$query = \OCP\DB::prepare($sql);
$manipulatedRows = $query->execute($args);
if ($manipulatedRows === 1) {
- $return = true;
+ $result = true;
+ \OCP\Util::writeLog('Encryption library', "Migration status set to " . self::MIGRATION_OPEN, \OCP\Util::INFO);
+ } else {
+ $result = false;
+ \OCP\Util::writeLog('Encryption library', "Could not set migration status to " . self::MIGRATION_OPEN, \OCP\Util::WARN);
+ }
+
+ return $result;
+ }
+
+ /**
+ * @brief start migration mode to initially encrypt users data
+ * @return boolean
+ */
+ public function beginMigration() {
+
+ $result = $this->setMigrationStatus(self::MIGRATION_IN_PROGRESS);
+
+ if ($result) {
\OCP\Util::writeLog('Encryption library', "Start migration to encryption mode for " . $this->userId, \OCP\Util::INFO);
} else {
\OCP\Util::writeLog('Encryption library', "Could not activate migration mode for " . $this->userId . ". Probably another process already started the initial encryption", \OCP\Util::WARN);
}
- return $return;
+ return $result;
+ }
+
+ public function resetMigrationStatus() {
+ return $this->setMigrationStatus(self::MIGRATION_OPEN);
+
}
/**
@@ -1214,22 +1252,15 @@ class Util {
* @return boolean
*/
public function finishMigration() {
+ $result = $this->setMigrationStatus(self::MIGRATION_COMPLETED);
- $return = false;
-
- $sql = 'UPDATE `*PREFIX*encryption` SET `migration_status` = ? WHERE `uid` = ? and `migration_status` = ?';
- $args = array(self::MIGRATION_COMPLETED, $this->userId, self::MIGRATION_IN_PROGRESS);
- $query = \OCP\DB::prepare($sql);
- $manipulatedRows = $query->execute($args);
-
- if ($manipulatedRows === 1) {
- $return = true;
+ if ($result) {
\OCP\Util::writeLog('Encryption library', "Finish migration successfully for " . $this->userId, \OCP\Util::INFO);
} else {
\OCP\Util::writeLog('Encryption library', "Could not deactivate migration mode for " . $this->userId, \OCP\Util::WARN);
}
- return $return;
+ return $result;
}
/**
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'));
}
/**
diff --git a/apps/files_encryption/tests/util.php b/apps/files_encryption/tests/util.php
index f87502e6cab..f70e30c4d73 100755
--- a/apps/files_encryption/tests/util.php
+++ b/apps/files_encryption/tests/util.php
@@ -64,6 +64,8 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase {
function setUp() {
+ // login user
+ \Test_Encryption_Util::loginHelper(\Test_Encryption_Util::TEST_ENCRYPTION_UTIL_USER1);
\OC_User::setUserId(\Test_Encryption_Util::TEST_ENCRYPTION_UTIL_USER1);
$this->userId = \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_USER1;
$this->pass = \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_USER1;
@@ -358,9 +360,12 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase {
$fileInfoEncrypted = $this->view->getFileInfo($this->userId . '/files/' . $filename);
$this->assertTrue($fileInfoEncrypted instanceof \OC\Files\FileInfo);
+ $this->assertEquals($fileInfoEncrypted['encrypted'], 1);
- // encrypt all unencrypted files
- $util->decryptAll('/' . $this->userId . '/' . 'files');
+ // decrypt all encrypted files
+ $result = $util->decryptAll('/' . $this->userId . '/' . 'files');
+
+ $this->assertTrue($result);
$fileInfoUnencrypted = $this->view->getFileInfo($this->userId . '/files/' . $filename);
@@ -369,11 +374,83 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase {
// check if mtime and etags unchanged
$this->assertEquals($fileInfoEncrypted['mtime'], $fileInfoUnencrypted['mtime']);
$this->assertEquals($fileInfoEncrypted['etag'], $fileInfoUnencrypted['etag']);
+ // file should no longer be encrypted
+ $this->assertEquals(0, $fileInfoUnencrypted['encrypted']);
$this->view->unlink($this->userId . '/files/' . $filename);
}
+ function testDescryptAllWithBrokenFiles() {
+
+ $file1 = "/decryptAll1" . uniqid() . ".txt";
+ $file2 = "/decryptAll2" . uniqid() . ".txt";
+
+ $util = new Encryption\Util($this->view, $this->userId);
+
+ $this->view->file_put_contents($this->userId . '/files/' . $file1, $this->dataShort);
+ $this->view->file_put_contents($this->userId . '/files/' . $file2, $this->dataShort);
+
+ $fileInfoEncrypted1 = $this->view->getFileInfo($this->userId . '/files/' . $file1);
+ $fileInfoEncrypted2 = $this->view->getFileInfo($this->userId . '/files/' . $file2);
+
+ $this->assertTrue($fileInfoEncrypted1 instanceof \OC\Files\FileInfo);
+ $this->assertTrue($fileInfoEncrypted2 instanceof \OC\Files\FileInfo);
+ $this->assertEquals($fileInfoEncrypted1['encrypted'], 1);
+ $this->assertEquals($fileInfoEncrypted2['encrypted'], 1);
+
+ // rename keyfile for file1 so that the decryption for file1 fails
+ // Expected behaviour: decryptAll() returns false, file2 gets decrypted anyway
+ $this->view->rename($this->userId . '/files_encryption/keyfiles/' . $file1 . '.key',
+ $this->userId . '/files_encryption/keyfiles/' . $file1 . '.key.moved');
+
+ // decrypt all encrypted files
+ $result = $util->decryptAll('/' . $this->userId . '/' . 'files');
+
+ $this->assertFalse($result);
+
+ $fileInfoUnencrypted1 = $this->view->getFileInfo($this->userId . '/files/' . $file1);
+ $fileInfoUnencrypted2 = $this->view->getFileInfo($this->userId . '/files/' . $file2);
+
+ $this->assertTrue($fileInfoUnencrypted1 instanceof \OC\Files\FileInfo);
+ $this->assertTrue($fileInfoUnencrypted2 instanceof \OC\Files\FileInfo);
+
+ // file1 should be still encrypted; file2 should be decrypted
+ $this->assertEquals(1, $fileInfoUnencrypted1['encrypted']);
+ $this->assertEquals(0, $fileInfoUnencrypted2['encrypted']);
+
+ // keyfiles and share keys should still exist
+ $this->assertTrue($this->view->is_dir($this->userId . '/files_encryption/keyfiles/'));
+ $this->assertTrue($this->view->is_dir($this->userId . '/files_encryption/share-keys/'));
+
+ // rename the keyfile for file1 back
+ $this->view->rename($this->userId . '/files_encryption/keyfiles/' . $file1 . '.key.moved',
+ $this->userId . '/files_encryption/keyfiles/' . $file1 . '.key');
+
+ // try again to decrypt all encrypted files
+ $result = $util->decryptAll('/' . $this->userId . '/' . 'files');
+
+ $this->assertTrue($result);
+
+ $fileInfoUnencrypted1 = $this->view->getFileInfo($this->userId . '/files/' . $file1);
+ $fileInfoUnencrypted2 = $this->view->getFileInfo($this->userId . '/files/' . $file2);
+
+ $this->assertTrue($fileInfoUnencrypted1 instanceof \OC\Files\FileInfo);
+ $this->assertTrue($fileInfoUnencrypted2 instanceof \OC\Files\FileInfo);
+
+ // now both files should be decrypted
+ $this->assertEquals(0, $fileInfoUnencrypted1['encrypted']);
+ $this->assertEquals(0, $fileInfoUnencrypted2['encrypted']);
+
+ // keyfiles and share keys should be deleted
+ $this->assertFalse($this->view->is_dir($this->userId . '/files_encryption/keyfiles/'));
+ $this->assertFalse($this->view->is_dir($this->userId . '/files_encryption/share-keys/'));
+
+ $this->view->unlink($this->userId . '/files/' . $file1);
+ $this->view->unlink($this->userId . '/files/' . $file2);
+
+ }
+
/**
* @large
*/
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php
index 436469236ba..064c1e20a93 100644
--- a/apps/files_external/lib/google.php
+++ b/apps/files_external/lib/google.php
@@ -524,6 +524,7 @@ class Google extends \OC\Files\Storage\Common {
}
public function hasUpdated($path, $time) {
+ $appConfig = \OC::$server->getAppConfig();
if ($this->is_file($path)) {
return parent::hasUpdated($path, $time);
} else {
@@ -533,7 +534,7 @@ class Google extends \OC\Files\Storage\Common {
if ($folder) {
$result = false;
$folderId = $folder->getId();
- $startChangeId = \OC_Appconfig::getValue('files_external', $this->getId().'cId');
+ $startChangeId = $appConfig->getValue('files_external', $this->getId().'cId');
$params = array(
'includeDeleted' => true,
'includeSubscribed' => true,
@@ -578,7 +579,7 @@ class Google extends \OC\Files\Storage\Common {
break;
}
}
- \OC_Appconfig::setValue('files_external', $this->getId().'cId', $largestChangeId);
+ $appConfig->setValue('files_external', $this->getId().'cId', $largestChangeId);
return $result;
}
}
diff --git a/apps/files_sharing/css/public.css b/apps/files_sharing/css/public.css
index 21f0c82b829..5246a4b2fec 100644
--- a/apps/files_sharing/css/public.css
+++ b/apps/files_sharing/css/public.css
@@ -66,7 +66,8 @@ p.info a {
margin:0 auto;
}
-#imgframe img {
+#imgframe img,
+#imgframe video {
max-height:100%;
max-width:100%;
}
@@ -76,6 +77,8 @@ p.info a {
margin-top: 10%;
}
+
+
thead {
padding-left: 0 !important; /* fixes multiselect bar offset on shared page */
}
diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php
index 061e60ad8ed..19a2d22b068 100644
--- a/apps/files_sharing/lib/api.php
+++ b/apps/files_sharing/lib/api.php
@@ -218,7 +218,7 @@ class Api {
//allow password protection
$shareWith = isset($_POST['password']) ? $_POST['password'] : null;
//check public link share
- $publicUploadEnabled = \OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes');
+ $publicUploadEnabled = \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_public_upload', 'yes');
if(isset($_POST['publicUpload']) && $publicUploadEnabled !== 'yes') {
return new \OC_OCS_Result(null, 403, "public upload disabled by the administrator");
}
@@ -317,7 +317,7 @@ class Api {
$shareType = $share['share_type'];
$permissions = isset($params['_put']['permissions']) ? (int)$params['_put']['permissions'] : null;
- $publicUploadStatus = \OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes');
+ $publicUploadStatus = \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_public_upload', 'yes');
$publicUploadEnabled = ($publicUploadStatus === 'yes') ? true : false;
@@ -356,7 +356,7 @@ class Api {
*/
private static function updatePublicUpload($share, $params) {
- $publicUploadEnabled = \OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes');
+ $publicUploadEnabled = \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_public_upload', 'yes');
if($publicUploadEnabled !== 'yes') {
return new \OC_OCS_Result(null, 403, "public upload disabled by the administrator");
}
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index f03ac7205a3..e7a5f5024b8 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -2,7 +2,9 @@
// Load other apps for file previews
OC_App::loadApps();
-if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
+$appConfig = \OC::$server->getAppConfig();
+
+if ($appConfig->getValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
header('HTTP/1.0 404 Not Found');
$tmpl = new OCP\Template('', '404', 'guest');
$tmpl->printPage();
@@ -151,7 +153,7 @@ if (isset($path)) {
$tmpl->assign('dirToken', $linkItem['token']);
$tmpl->assign('sharingToken', $token);
$allowPublicUploadEnabled = (bool) ($linkItem['permissions'] & OCP\PERMISSION_CREATE);
- if (OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes') === 'no') {
+ if ($appConfig->getValue('core', 'shareapi_allow_public_upload', 'yes') === 'no') {
$allowPublicUploadEnabled = false;
}
if ($linkItem['item_type'] !== 'folder') {
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php
index 56ab2e72c7b..bc77e9c1543 100644
--- a/apps/files_trashbin/lib/trashbin.php
+++ b/apps/files_trashbin/lib/trashbin.php
@@ -733,7 +733,7 @@ class Trashbin {
$quota = \OC_Preferences::getValue($user, 'files', 'quota');
$view = new \OC\Files\View('/' . $user);
if ($quota === null || $quota === 'default') {
- $quota = \OC_Appconfig::getValue('files', 'default_quota');
+ $quota = \OC::$server->getAppConfig()->getValue('files', 'default_quota');
}
if ($quota === null || $quota === 'none') {
$quota = \OC\Files\Filesystem::free_space('/');
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index 6eb39d21cf3..fc0bf3bfad0 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -487,7 +487,7 @@ class Storage {
$softQuota = true;
$quota = \OC_Preferences::getValue($uid, 'files', 'quota');
if ( $quota === null || $quota === 'default') {
- $quota = \OC_Appconfig::getValue('files', 'default_quota');
+ $quota = \OC::$server->getAppConfig()->getValue('files', 'default_quota');
}
if ( $quota === null || $quota === 'none' ) {
$quota = \OC\Files\Filesystem::free_space('/');
diff --git a/apps/user_ldap/templates/part.wizard-groupfilter.php b/apps/user_ldap/templates/part.wizard-groupfilter.php
index 0cc4dfa572a..e460997b1bf 100644
--- a/apps/user_ldap/templates/part.wizard-groupfilter.php
+++ b/apps/user_ldap/templates/part.wizard-groupfilter.php
@@ -1,7 +1,7 @@
<fieldset id="ldapWizard4">
<div>
<p>
- <?php p($l->t('Limit the access to %s to groups meeting this criteria:', $theme->getName()));?>
+ <?php p($l->t('Groups meeting these criteria are available in %s:', $theme->getName()));?>
</p>
<p>
<label for="ldap_groupfilter_objectclass">
diff --git a/apps/user_ldap/templates/part.wizard-loginfilter.php b/apps/user_ldap/templates/part.wizard-loginfilter.php
index dc5d61e9f77..3dde46fa979 100644
--- a/apps/user_ldap/templates/part.wizard-loginfilter.php
+++ b/apps/user_ldap/templates/part.wizard-loginfilter.php
@@ -1,7 +1,7 @@
<fieldset id="ldapWizard3">
<div>
<p>
- <?php p($l->t('What attribute shall be used as login name:'));?>
+ <?php p($l->t('Users login with this attribute:'));?>
</p>
<p>
<label for="ldap_loginfilter_username">
diff --git a/apps/user_ldap/templates/part.wizard-userfilter.php b/apps/user_ldap/templates/part.wizard-userfilter.php
index c1d522ce2a6..eff9f89ce2c 100644
--- a/apps/user_ldap/templates/part.wizard-userfilter.php
+++ b/apps/user_ldap/templates/part.wizard-userfilter.php
@@ -1,7 +1,7 @@
<fieldset id="ldapWizard2">
<div>
<p>
- <?php p($l->t('Limit the access to %s to users meeting this criteria:', $theme->getName()));?>
+ <?php p($l->t('Limit %s access to users meeting these criteria:', $theme->getName()));?>
</p>
<p>
<label for="ldap_userfilter_objectclass">