Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/privacy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/AdminController.php13
-rw-r--r--lib/Settings/WhoHasAccessSettings.php25
2 files changed, 38 insertions, 0 deletions
diff --git a/lib/Controller/AdminController.php b/lib/Controller/AdminController.php
index b13e81b..f8bfaca 100644
--- a/lib/Controller/AdminController.php
+++ b/lib/Controller/AdminController.php
@@ -98,4 +98,17 @@ class AdminController extends Controller {
return new JSONResponse([], Http::STATUS_OK);
}
+ /**
+ * @param string $enabled
+ * @return JSONResponse
+ */
+ public function setFullDiskEncryption(string $enabled):JSONResponse {
+ $allowedValues = ['0', '1'];
+ if (!\in_array($enabled, $allowedValues, true)) {
+ return new JSONResponse([], HTTP::STATUS_NOT_ACCEPTABLE);
+ }
+
+ $this->config->setAppValue('privacy', 'fullDiskEncryptionEnabled', $enabled);
+ return new JSONResponse([], HTTP::STATUS_OK);
+ }
}
diff --git a/lib/Settings/WhoHasAccessSettings.php b/lib/Settings/WhoHasAccessSettings.php
index cd39a4e..64aeaeb 100644
--- a/lib/Settings/WhoHasAccessSettings.php
+++ b/lib/Settings/WhoHasAccessSettings.php
@@ -24,6 +24,8 @@ namespace OCA\Privacy\Settings;
use OC;
use OCA\Theming\ThemingDefaults;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IConfig;
+use OCP\Encryption\IManager as IEncryptionManager;
use OCP\Settings\ISettings;
/**
@@ -33,6 +35,24 @@ use OCP\Settings\ISettings;
*/
class WhoHasAccessSettings implements ISettings {
+ /** @var IConfig */
+ private $config;
+
+ /** @var IEncryptionManager */
+ private $encryptionManager;
+
+ /**
+ * WhoHasAccessSettings constructor.
+ *
+ * @param IConfig $config
+ * @param IEncryptionManager $manager
+ */
+ public function __construct(IConfig $config, IEncryptionManager $manager) {
+ $this->config = $config;
+ $this->encryptionManager = $manager;
+
+ }
+
/**
* @return TemplateResponse
*/
@@ -44,8 +64,13 @@ class WhoHasAccessSettings implements ISettings {
$privacyPolicyUrl = null;
}
+ $fullDiskEncryption = $this->config->getAppValue('privacy', 'fullDiskEncryptionEnabled', '0');
+ $serverSideEncryption = $this->encryptionManager->isEnabled();
+
return new TemplateResponse('privacy', 'who-has-access', [
'privacyPolicyUrl' => $privacyPolicyUrl,
+ 'fullDiskEncryptionEnabled' => $fullDiskEncryption,
+ 'serverSideEncryptionEnabled' => $serverSideEncryption ? '1' : '0',
]);
}