diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-04-29 15:00:57 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-13 12:35:25 +0200 |
commit | a9ac11718e62017c70682f99eb35b43b1ef9c498 (patch) | |
tree | d4874aca27972f45acdb756ba2200f886617141b /settings/ajax/deletekeys.php | |
parent | 254fa5eb22efa5ba572702064377a6ad9eec9a53 (diff) | |
download | nextcloud-server-a9ac11718e62017c70682f99eb35b43b1ef9c498.tar.gz nextcloud-server-a9ac11718e62017c70682f99eb35b43b1ef9c498.zip |
backup the encryption key after the encryption was disabled so that the user
can restore them if needed
Diffstat (limited to 'settings/ajax/deletekeys.php')
-rw-r--r-- | settings/ajax/deletekeys.php | 17 |
1 files changed, 17 insertions, 0 deletions
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')))); +} |