summaryrefslogtreecommitdiffstats
path: root/settings/ajax
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2013-08-18 09:51:48 -0700
committerBjörn Schießle <bjoern@schiessle.org>2013-08-18 09:51:48 -0700
commit9be836814cb4165ea54a086a0f97526d783bcd37 (patch)
treead57d30194571edcf0f51cd83178b8ac2f03c0aa /settings/ajax
parentc620c5840ab8ca45531c7639e086bafbd87d7365 (diff)
parentd544a371bfb84f36a3b789d19d44d6694de21c48 (diff)
downloadnextcloud-server-9be836814cb4165ea54a086a0f97526d783bcd37.tar.gz
nextcloud-server-9be836814cb4165ea54a086a0f97526d783bcd37.zip
Merge pull request #4239 from owncloud/decrypt_files_again
Enable user to decrypt files again after encryption app was disabled
Diffstat (limited to 'settings/ajax')
-rw-r--r--settings/ajax/decryptall.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/settings/ajax/decryptall.php b/settings/ajax/decryptall.php
new file mode 100644
index 00000000000..e53067931e8
--- /dev/null
+++ b/settings/ajax/decryptall.php
@@ -0,0 +1,25 @@
+<?php
+
+//encryption app needs to be loaded
+OC_App::loadApp('files_encryption');
+
+// init encryption app
+$params = array('uid' => \OCP\User::getUser(),
+ 'password' => $_POST['password']);
+
+$view = new OC_FilesystemView('/');
+$util = new \OCA\Encryption\Util($view, \OCP\User::getUser());
+
+$result = $util->initEncryption($params);
+
+if ($result !== false) {
+ $successful = $util->decryptAll();
+ if ($successful === true) {
+ \OCP\JSON::success(array('data' => array('message' => 'Files decrypted successfully')));
+ } else {
+ \OCP\JSON::error(array('data' => array('message' => 'Couldn\'t decrypt your files, please check your owncloud.log or ask your administrator')));
+ }
+} else {
+ \OCP\JSON::error(array('data' => array('message' => 'Couldn\'t decrypt your files, check your password and try again')));
+}
+