diff options
author | Georg Ehrke <developer@georgehrke.com> | 2019-11-27 09:47:47 +0300 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2020-04-17 11:18:18 +0300 |
commit | c0615e3a55885e341bb82e2f8fdb3b2f8e6f49c9 (patch) | |
tree | d1c142a6c99b3ca5409862a2c95769dc72aa0dfb /lib | |
parent | 3f3f4af7cbb677abd151e2912cbb99fe81bebcd2 (diff) |
Move to new nextcloud npm packages
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/PersonalController.php | 19 | ||||
-rw-r--r-- | lib/Settings/WhereIsYourDataSettings.php | 23 | ||||
-rw-r--r-- | lib/Settings/WhoHasAccessSettings.php | 22 |
3 files changed, 37 insertions, 27 deletions
diff --git a/lib/Controller/PersonalController.php b/lib/Controller/PersonalController.php index 6b7a56b..4b94075 100644 --- a/lib/Controller/PersonalController.php +++ b/lib/Controller/PersonalController.php @@ -69,23 +69,6 @@ class PersonalController extends Controller { * * @return JSONResponse */ - public function getReadableLocation():JSONResponse { - $location = $this->config->getAppValue($this->appName, 'readableLocation'); - - if ($location === null) { - return new JSONResponse([], Http::STATUS_NOT_FOUND); - } - - return new JSONResponse([ - 'code' => $location, - ], Http::STATUS_OK); - } - - /** - * @NoAdminRequired - * - * @return JSONResponse - */ public function getAdmins():JSONResponse { $adminGroup = $this->groupManager->get('admin'); @@ -107,7 +90,7 @@ class PersonalController extends Controller { 'internal' => true, ]; } - + $query = $this->dbConnection->getQueryBuilder(); $query->select(['id', 'displayname']) ->from('privacy_admins'); diff --git a/lib/Settings/WhereIsYourDataSettings.php b/lib/Settings/WhereIsYourDataSettings.php index a640e62..5eb0d19 100644 --- a/lib/Settings/WhereIsYourDataSettings.php +++ b/lib/Settings/WhereIsYourDataSettings.php @@ -22,6 +22,8 @@ namespace OCA\Privacy\Settings; use OCP\AppFramework\Http\TemplateResponse; +use OCP\IConfig; +use OCP\IInitialStateService; use OCP\Settings\ISettings; /** @@ -31,10 +33,31 @@ use OCP\Settings\ISettings; */ class WhereIsYourDataSettings implements ISettings { + /** @var IInitialStateService */ + private $initialStateService; + + /** @var IConfig */ + private $config; + + /** + * MissionSettings constructor. + * + * @param IInitialStateService $initialStateService + * @param IConfig $config + */ + public function __construct(IInitialStateService $initialStateService, + IConfig $config) { + $this->initialStateService = $initialStateService; + $this->config = $config; + } + /** * @return TemplateResponse */ public function getForm():TemplateResponse { + $location = $this->config->getAppValue('privacy', 'readableLocation'); + $this->initialStateService->provideInitialState('privacy', 'location', $location ?: ''); + return new TemplateResponse('privacy', 'where-is-your-data'); } diff --git a/lib/Settings/WhoHasAccessSettings.php b/lib/Settings/WhoHasAccessSettings.php index 64aeaeb..0227103 100644 --- a/lib/Settings/WhoHasAccessSettings.php +++ b/lib/Settings/WhoHasAccessSettings.php @@ -26,6 +26,7 @@ use OCA\Theming\ThemingDefaults; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\Encryption\IManager as IEncryptionManager; +use OCP\IInitialStateService; use OCP\Settings\ISettings; /** @@ -41,16 +42,22 @@ class WhoHasAccessSettings implements ISettings { /** @var IEncryptionManager */ private $encryptionManager; + /** @var IInitialStateService */ + private $initialStateService; + /** * WhoHasAccessSettings constructor. * * @param IConfig $config * @param IEncryptionManager $manager + * @param IInitialStateService $initialStateService */ - public function __construct(IConfig $config, IEncryptionManager $manager) { + public function __construct(IConfig $config, + IEncryptionManager $manager, + IInitialStateService $initialStateService) { $this->config = $config; $this->encryptionManager = $manager; - + $this->initialStateService = $initialStateService; } /** @@ -64,14 +71,11 @@ class WhoHasAccessSettings implements ISettings { $privacyPolicyUrl = null; } - $fullDiskEncryption = $this->config->getAppValue('privacy', 'fullDiskEncryptionEnabled', '0'); - $serverSideEncryption = $this->encryptionManager->isEnabled(); + $this->initialStateService->provideInitialState('privacy', 'privacyPolicyUrl', $privacyPolicyUrl); + $this->initialStateService->provideInitialState('privacy', 'fullDiskEncryptionEnabled', $this->config->getAppValue('privacy', 'fullDiskEncryptionEnabled', '0')); + $this->initialStateService->provideInitialState('privacy', 'serverSideEncryptionEnabled', $this->encryptionManager->isEnabled() ? '1' : '0'); - return new TemplateResponse('privacy', 'who-has-access', [ - 'privacyPolicyUrl' => $privacyPolicyUrl, - 'fullDiskEncryptionEnabled' => $fullDiskEncryption, - 'serverSideEncryptionEnabled' => $serverSideEncryption ? '1' : '0', - ]); + return new TemplateResponse('privacy', 'who-has-access'); } /** |