summaryrefslogtreecommitdiffstats
path: root/settings/ajax
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2014-05-31 14:55:00 +0200
committerGeorg Ehrke <developer@georgehrke.com>2014-05-31 14:55:00 +0200
commitc8636ca4d9528faf42b1cd877bb73e56d26244cf (patch)
treeb65bc6f1d6af00e15e97eb2cc518eeda2a9896e3 /settings/ajax
parent2bcfd8e084b27ed89cf6e62bc9ab2c681d5a8361 (diff)
parentcff9440a37a64a43403b7dd57a99a203410e426a (diff)
downloadnextcloud-server-c8636ca4d9528faf42b1cd877bb73e56d26244cf.tar.gz
nextcloud-server-c8636ca4d9528faf42b1cd877bb73e56d26244cf.zip
Merge branch 'master' into update_shipped_apps_from_appstore
Conflicts: lib/private/app.php lib/private/installer.php
Diffstat (limited to 'settings/ajax')
-rw-r--r--settings/ajax/decryptall.php2
-rw-r--r--settings/ajax/deletekeys.php17
-rw-r--r--settings/ajax/excludegroups.php18
-rw-r--r--settings/ajax/restorekeys.php24
4 files changed, 60 insertions, 1 deletions
diff --git a/settings/ajax/decryptall.php b/settings/ajax/decryptall.php
index d12df230d41..55685f778d1 100644
--- a/settings/ajax/decryptall.php
+++ b/settings/ajax/decryptall.php
@@ -10,7 +10,7 @@ OC_App::loadApp('files_encryption');
$params = array('uid' => \OCP\User::getUser(),
'password' => $_POST['password']);
-$view = new OC_FilesystemView('/');
+$view = new OC\Files\View('/');
$util = new \OCA\Encryption\Util($view, \OCP\User::getUser());
$l = \OC_L10N::get('settings');
diff --git a/settings/ajax/deletekeys.php b/settings/ajax/deletekeys.php
new file mode 100644
index 00000000000..1f84452e117
--- /dev/null
+++ b/settings/ajax/deletekeys.php
@@ -0,0 +1,17 @@
+<?php
+
+OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
+
+$l = \OC_L10N::get('settings');
+$user = \OC_User::getUser();
+$view = new \OC\Files\View('/' . $user . '/files_encryption');
+
+$keyfilesDeleted = $view->deleteAll('keyfiles.backup');
+$sharekeysDeleted = $view->deleteAll('share-keys.backup');
+
+if ($keyfilesDeleted && $sharekeysDeleted) {
+ \OCP\JSON::success(array('data' => array('message' => $l->t('Encryption keys deleted permanently'))));
+} else {
+ \OCP\JSON::error(array('data' => array('message' => $l->t('Couldn\'t permanently delete your encryption keys, please check your owncloud.log or ask your administrator'))));
+}
diff --git a/settings/ajax/excludegroups.php b/settings/ajax/excludegroups.php
new file mode 100644
index 00000000000..2934a448a6a
--- /dev/null
+++ b/settings/ajax/excludegroups.php
@@ -0,0 +1,18 @@
+<?php
+OC_JSON::checkSubAdminUser();
+OCP\JSON::callCheck();
+
+$selectedGroups = isset($_POST["selectedGroups"]) ? json_decode($_POST["selectedGroups"]) : array();
+$changedGroup = isset($_POST["changedGroup"]) ? $_POST["changedGroup"] : '';
+
+if ($changedGroup !== '') {
+ if(($key = array_search($changedGroup, $selectedGroups)) !== false) {
+ unset($selectedGroups[$key]);
+ } else {
+ $selectedGroups[] = $changedGroup;
+ }
+} else {
+ \OCP\Util::writeLog('core', 'Can not update list of excluded groups from sharing, parameter missing', \OCP\Util::WARN);
+}
+
+\OC_Appconfig::setValue('core', 'shareapi_exclude_groups_list', implode(',', $selectedGroups));
diff --git a/settings/ajax/restorekeys.php b/settings/ajax/restorekeys.php
new file mode 100644
index 00000000000..68e19c90457
--- /dev/null
+++ b/settings/ajax/restorekeys.php
@@ -0,0 +1,24 @@
+<?php
+
+OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
+
+$l = \OC_L10N::get('settings');
+$user = \OC_User::getUser();
+$view = new \OC\Files\View('/' . $user . '/files_encryption');
+
+$keyfilesRestored = $view->rename('keyfiles.backup', 'keyfiles');
+$sharekeysRestored = $view->rename('share-keys.backup' , 'share-keys');
+
+if ($keyfilesRestored && $sharekeysRestored) {
+ \OCP\JSON::success(array('data' => array('message' => $l->t('Backups restored successfully'))));
+} else {
+ // if one of the move operation was succesful we remove the files back to have a consistent state
+ if($keyfilesRestored) {
+ $view->rename('keyfiles', 'keyfiles.backup');
+ }
+ if($sharekeysRestored) {
+ $view->rename('share-keys' , 'share-keys.backup');
+ }
+ \OCP\JSON::error(array('data' => array('message' => $l->t('Couldn\'t restore your encryption keys, please check your owncloud.log or ask your administrator'))));
+}