aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/hooks/hooks.php
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@owncloud.com>2013-09-23 12:44:11 +0200
committerAndreas Fischer <bantu@owncloud.com>2013-09-23 12:44:11 +0200
commit4a9f1cc74d7323b43983023c2b5b28e550e8c85d (patch)
tree13b09a7b9bc56eaffa3872de0260896b2916ca30 /apps/files_encryption/hooks/hooks.php
parent2a17025d537c41b9366c9592c985b911d9394337 (diff)
parent9851f0f4f2a97dc6ac1382bcd533eb23feffa4e0 (diff)
downloadnextcloud-server-4a9f1cc74d7323b43983023c2b5b28e550e8c85d.tar.gz
nextcloud-server-4a9f1cc74d7323b43983023c2b5b28e550e8c85d.zip
Merge remote-tracking branch 'owncloud/master' into fixing-4866-master
* owncloud/master: (98 commits) [tx-robot] updated from transifex files: when filtering search results, ensure results are children of the fakeroot not just path starting the same setting a default on filecache column unencrypted_size [tx-robot] updated from transifex remove unneccessary lib in namespace namespaces use upcasefirst parts when _ is left in namespace and files are named after their classes the autoloader will also find classes in the lib folder of an app its magic! initialize variable calculate correct permissions while toggle the password protection make sure that both $permissions and $oldPermissions have the same type Add copyright, remove starting blank line update inherit docs comment Fix insert/update/delete helper functions for oracle Add missing return true statements to legacy preferences functions Add missing static Convert OC_Preference to object interface fix race condition in lazy preview loading use {count} instead of 'One' for more versatile translation fix double translation of error message use n to translate title fixing typos and l10n ... Conflicts: tests/lib/files/cache/scanner.php
Diffstat (limited to 'apps/files_encryption/hooks/hooks.php')
-rw-r--r--apps/files_encryption/hooks/hooks.php37
1 files changed, 21 insertions, 16 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 85169e6a1d0..d9221c6e828 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -44,17 +44,22 @@ class Hooks {
\OC_Util::setupFS($params['uid']);
}
- $util = new Util($view, $params['uid']);
-
- //check if all requirements are met
- if(!$util->ready() && (!Helper::checkRequirements() || !Helper::checkConfiguration())) {
- $error_msg = $l->t("Missing requirements.");
- $hint = $l->t('Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');
- \OC_App::disable('files_encryption');
- \OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);
- \OCP\Template::printErrorPage($error_msg, $hint);
+ $privateKey = \OCA\Encryption\Keymanager::getPrivateKey($view, $params['uid']);
+
+ // if no private key exists, check server configuration
+ if(!$privateKey) {
+ //check if all requirements are met
+ if(!Helper::checkRequirements() || !Helper::checkConfiguration()) {
+ $error_msg = $l->t("Missing requirements.");
+ $hint = $l->t('Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');
+ \OC_App::disable('files_encryption');
+ \OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);
+ \OCP\Template::printErrorPage($error_msg, $hint);
+ }
}
+ $util = new Util($view, $params['uid']);
+
// setup user, if user not ready force relogin
if (Helper::setupUser($util, $params['password']) === false) {
return false;
@@ -73,7 +78,7 @@ class Hooks {
$userView = new \OC_FilesystemView('/' . $params['uid']);
- // Set legacy encryption key if it exists, to support
+ // Set legacy encryption key if it exists, to support
// depreciated encryption system
if (
$userView->file_exists('encryption.key')
@@ -249,7 +254,7 @@ class Hooks {
$params['run'] = false;
$params['error'] = $l->t('Following users are not set up for encryption:') . ' ' . join(', ' , $notConfigured);
}
-
+
}
/**
@@ -260,7 +265,7 @@ class Hooks {
// NOTE: $params has keys:
// [itemType] => file
// itemSource -> int, filecache file ID
- // [parent] =>
+ // [parent] =>
// [itemTarget] => /13
// shareWith -> string, uid of user being shared to
// fileTarget -> path of file being shared
@@ -301,13 +306,13 @@ class Hooks {
// NOTE: parent is folder but shared was a file!
// we try to rebuild the missing path
// some examples we face here
- // user1 share folder1 with user2 folder1 has
- // the following structure
+ // user1 share folder1 with user2 folder1 has
+ // the following structure
// /folder1/subfolder1/subsubfolder1/somefile.txt
// user2 re-share subfolder2 with user3
// user3 re-share somefile.txt user4
- // so our path should be
- // /Shared/subfolder1/subsubfolder1/somefile.txt
+ // so our path should be
+ // /Shared/subfolder1/subsubfolder1/somefile.txt
// while user3 is sharing
if ($params['itemType'] === 'file') {