summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-05-30 12:49:47 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2019-05-30 12:49:47 +0200
commit5ab4daad961d46b6aed9aba891f9569ad7a21f93 (patch)
treefb40bf2379ee2be06ecd3c4c6ce87a79c74c136f /lib
parentfd9ff581e2a92f65def3f5d3209c4328fb65416a (diff)
downloadnextcloud-server-5ab4daad961d46b6aed9aba891f9569ad7a21f93.tar.gz
nextcloud-server-5ab4daad961d46b6aed9aba891f9569ad7a21f93.zip
Move OC\Settings\Admin and OC\Settings\Personal to actual settings
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/composer/composer/autoload_classmap.php18
-rw-r--r--lib/composer/composer/autoload_static.php18
-rw-r--r--lib/private/Settings/Admin/Mail.php91
-rw-r--r--lib/private/Settings/Admin/Overview.php66
-rw-r--r--lib/private/Settings/Admin/Security.php109
-rw-r--r--lib/private/Settings/Admin/Server.php106
-rw-r--r--lib/private/Settings/Admin/Sharing.php137
-rw-r--r--lib/private/Settings/Personal/Additional.php59
-rw-r--r--lib/private/Settings/Personal/PersonalInfo.php280
-rw-r--r--lib/private/Settings/Personal/Security.php188
-rw-r--r--lib/private/Settings/Personal/ServerDevNotice.php54
11 files changed, 18 insertions, 1108 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 5f26f0c356a..1fa9c411165 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -1107,11 +1107,11 @@ return array(
'OC\\Settings\\Activity\\SecurityProvider' => $baseDir . '/settings/Activity/SecurityProvider.php',
'OC\\Settings\\Activity\\SecuritySetting' => $baseDir . '/settings/Activity/SecuritySetting.php',
'OC\\Settings\\Activity\\Setting' => $baseDir . '/settings/Activity/Setting.php',
- 'OC\\Settings\\Admin\\Mail' => $baseDir . '/lib/private/Settings/Admin/Mail.php',
- 'OC\\Settings\\Admin\\Overview' => $baseDir . '/lib/private/Settings/Admin/Overview.php',
- 'OC\\Settings\\Admin\\Security' => $baseDir . '/lib/private/Settings/Admin/Security.php',
- 'OC\\Settings\\Admin\\Server' => $baseDir . '/lib/private/Settings/Admin/Server.php',
- 'OC\\Settings\\Admin\\Sharing' => $baseDir . '/lib/private/Settings/Admin/Sharing.php',
+ 'OC\\Settings\\Admin\\Mail' => $baseDir . '/settings/Settings/Admin/Mail.php',
+ 'OC\\Settings\\Admin\\Overview' => $baseDir . '/settings/Settings/Admin/Overview.php',
+ 'OC\\Settings\\Admin\\Security' => $baseDir . '/settings/Settings/Admin/Security.php',
+ 'OC\\Settings\\Admin\\Server' => $baseDir . '/settings/Settings/Admin/Server.php',
+ 'OC\\Settings\\Admin\\Sharing' => $baseDir . '/settings/Settings/Admin/Sharing.php',
'OC\\Settings\\Application' => $baseDir . '/settings/Application.php',
'OC\\Settings\\BackgroundJobs\\VerifyUserData' => $baseDir . '/settings/BackgroundJobs/VerifyUserData.php',
'OC\\Settings\\Controller\\AdminSettingsController' => $baseDir . '/settings/Controller/AdminSettingsController.php',
@@ -1130,10 +1130,10 @@ return array(
'OC\\Settings\\Mailer\\NewUserMailHelper' => $baseDir . '/settings/Mailer/NewUserMailHelper.php',
'OC\\Settings\\Manager' => $baseDir . '/lib/private/Settings/Manager.php',
'OC\\Settings\\Middleware\\SubadminMiddleware' => $baseDir . '/settings/Middleware/SubadminMiddleware.php',
- 'OC\\Settings\\Personal\\Additional' => $baseDir . '/lib/private/Settings/Personal/Additional.php',
- 'OC\\Settings\\Personal\\PersonalInfo' => $baseDir . '/lib/private/Settings/Personal/PersonalInfo.php',
- 'OC\\Settings\\Personal\\Security' => $baseDir . '/lib/private/Settings/Personal/Security.php',
- 'OC\\Settings\\Personal\\ServerDevNotice' => $baseDir . '/lib/private/Settings/Personal/ServerDevNotice.php',
+ 'OC\\Settings\\Personal\\Additional' => $baseDir . '/settings/Settings/Personal/Additional.php',
+ 'OC\\Settings\\Personal\\PersonalInfo' => $baseDir . '/settings/Settings/Personal/PersonalInfo.php',
+ 'OC\\Settings\\Personal\\Security' => $baseDir . '/settings/Settings/Personal/Security.php',
+ 'OC\\Settings\\Personal\\ServerDevNotice' => $baseDir . '/settings/Settings/Personal/ServerDevNotice.php',
'OC\\Settings\\Section' => $baseDir . '/lib/private/Settings/Section.php',
'OC\\Setup' => $baseDir . '/lib/private/Setup.php',
'OC\\Setup\\AbstractDatabase' => $baseDir . '/lib/private/Setup/AbstractDatabase.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 2c01484d66b..d1e0c4d020b 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -1137,11 +1137,11 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Settings\\Activity\\SecurityProvider' => __DIR__ . '/../../..' . '/settings/Activity/SecurityProvider.php',
'OC\\Settings\\Activity\\SecuritySetting' => __DIR__ . '/../../..' . '/settings/Activity/SecuritySetting.php',
'OC\\Settings\\Activity\\Setting' => __DIR__ . '/../../..' . '/settings/Activity/Setting.php',
- 'OC\\Settings\\Admin\\Mail' => __DIR__ . '/../../..' . '/lib/private/Settings/Admin/Mail.php',
- 'OC\\Settings\\Admin\\Overview' => __DIR__ . '/../../..' . '/lib/private/Settings/Admin/Overview.php',
- 'OC\\Settings\\Admin\\Security' => __DIR__ . '/../../..' . '/lib/private/Settings/Admin/Security.php',
- 'OC\\Settings\\Admin\\Server' => __DIR__ . '/../../..' . '/lib/private/Settings/Admin/Server.php',
- 'OC\\Settings\\Admin\\Sharing' => __DIR__ . '/../../..' . '/lib/private/Settings/Admin/Sharing.php',
+ 'OC\\Settings\\Admin\\Mail' => __DIR__ . '/../../..' . '/settings/Settings/Admin/Mail.php',
+ 'OC\\Settings\\Admin\\Overview' => __DIR__ . '/../../..' . '/settings/Settings/Admin/Overview.php',
+ 'OC\\Settings\\Admin\\Security' => __DIR__ . '/../../..' . '/settings/Settings/Admin/Security.php',
+ 'OC\\Settings\\Admin\\Server' => __DIR__ . '/../../..' . '/settings/Settings/Admin/Server.php',
+ 'OC\\Settings\\Admin\\Sharing' => __DIR__ . '/../../..' . '/settings/Settings/Admin/Sharing.php',
'OC\\Settings\\Application' => __DIR__ . '/../../..' . '/settings/Application.php',
'OC\\Settings\\BackgroundJobs\\VerifyUserData' => __DIR__ . '/../../..' . '/settings/BackgroundJobs/VerifyUserData.php',
'OC\\Settings\\Controller\\AdminSettingsController' => __DIR__ . '/../../..' . '/settings/Controller/AdminSettingsController.php',
@@ -1160,10 +1160,10 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Settings\\Mailer\\NewUserMailHelper' => __DIR__ . '/../../..' . '/settings/Mailer/NewUserMailHelper.php',
'OC\\Settings\\Manager' => __DIR__ . '/../../..' . '/lib/private/Settings/Manager.php',
'OC\\Settings\\Middleware\\SubadminMiddleware' => __DIR__ . '/../../..' . '/settings/Middleware/SubadminMiddleware.php',
- 'OC\\Settings\\Personal\\Additional' => __DIR__ . '/../../..' . '/lib/private/Settings/Personal/Additional.php',
- 'OC\\Settings\\Personal\\PersonalInfo' => __DIR__ . '/../../..' . '/lib/private/Settings/Personal/PersonalInfo.php',
- 'OC\\Settings\\Personal\\Security' => __DIR__ . '/../../..' . '/lib/private/Settings/Personal/Security.php',
- 'OC\\Settings\\Personal\\ServerDevNotice' => __DIR__ . '/../../..' . '/lib/private/Settings/Personal/ServerDevNotice.php',
+ 'OC\\Settings\\Personal\\Additional' => __DIR__ . '/../../..' . '/settings/Settings/Personal/Additional.php',
+ 'OC\\Settings\\Personal\\PersonalInfo' => __DIR__ . '/../../..' . '/settings/Settings/Personal/PersonalInfo.php',
+ 'OC\\Settings\\Personal\\Security' => __DIR__ . '/../../..' . '/settings/Settings/Personal/Security.php',
+ 'OC\\Settings\\Personal\\ServerDevNotice' => __DIR__ . '/../../..' . '/settings/Settings/Personal/ServerDevNotice.php',
'OC\\Settings\\Section' => __DIR__ . '/../../..' . '/lib/private/Settings/Section.php',
'OC\\Setup' => __DIR__ . '/../../..' . '/lib/private/Setup.php',
'OC\\Setup\\AbstractDatabase' => __DIR__ . '/../../..' . '/lib/private/Setup/AbstractDatabase.php',
diff --git a/lib/private/Settings/Admin/Mail.php b/lib/private/Settings/Admin/Mail.php
deleted file mode 100644
index 40dcc3dba0d..00000000000
--- a/lib/private/Settings/Admin/Mail.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OC\Settings\Admin;
-
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
-use OCP\Settings\ISettings;
-
-class Mail implements ISettings {
- /** @var IConfig */
- private $config;
-
- /**
- * @param IConfig $config
- */
- public function __construct(IConfig $config) {
- $this->config = $config;
- }
-
- /**
- * @return TemplateResponse
- */
- public function getForm() {
- $parameters = [
- // Mail
- 'sendmail_is_available' => (bool) \OC_Helper::findBinaryPath('sendmail'),
- 'mail_domain' => $this->config->getSystemValue('mail_domain', ''),
- 'mail_from_address' => $this->config->getSystemValue('mail_from_address', ''),
- 'mail_smtpmode' => $this->config->getSystemValue('mail_smtpmode', ''),
- 'mail_smtpsecure' => $this->config->getSystemValue('mail_smtpsecure', ''),
- 'mail_smtphost' => $this->config->getSystemValue('mail_smtphost', ''),
- 'mail_smtpport' => $this->config->getSystemValue('mail_smtpport', ''),
- 'mail_smtpauthtype' => $this->config->getSystemValue('mail_smtpauthtype', ''),
- 'mail_smtpauth' => $this->config->getSystemValue('mail_smtpauth', false),
- 'mail_smtpname' => $this->config->getSystemValue('mail_smtpname', ''),
- 'mail_smtppassword' => $this->config->getSystemValue('mail_smtppassword', ''),
- 'mail_sendmailmode' => $this->config->getSystemValue('mail_sendmailmode', 'smtp'),
- ];
-
- if ($parameters['mail_smtppassword'] !== '') {
- $parameters['mail_smtppassword'] = '********';
- }
-
- if ($parameters['mail_smtpmode'] === '' || $parameters['mail_smtpmode'] === 'php') {
- $parameters['mail_smtpmode'] = 'smtp';
- }
-
- return new TemplateResponse('settings', 'settings/admin/additional-mail', $parameters, '');
- }
-
- /**
- * @return string the section ID, e.g. 'sharing'
- */
- public function getSection() {
- return 'server';
- }
-
- /**
- * @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
- *
- * E.g.: 70
- */
- public function getPriority() {
- return 10;
- }
-}
diff --git a/lib/private/Settings/Admin/Overview.php b/lib/private/Settings/Admin/Overview.php
deleted file mode 100644
index 51e5808f487..00000000000
--- a/lib/private/Settings/Admin/Overview.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OC\Settings\Admin;
-
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
-use OCP\Settings\ISettings;
-
-class Overview implements ISettings {
- /** @var IConfig */
- private $config;
-
- public function __construct(IConfig $config) {
- $this->config = $config;
- }
-
- /**
- * @return TemplateResponse
- */
- public function getForm() {
- $parameters = [
- 'checkForWorkingWellKnownSetup' => $this->config->getSystemValue('check_for_working_wellknown_setup', true),
- ];
-
- return new TemplateResponse('settings', 'settings/admin/overview', $parameters, '');
- }
-
- /**
- * @return string the section ID, e.g. 'sharing'
- */
- public function getSection() {
- return 'overview';
- }
-
- /**
- * @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
- *
- * E.g.: 70
- */
- public function getPriority() {
- return 10;
- }
-}
diff --git a/lib/private/Settings/Admin/Security.php b/lib/private/Settings/Admin/Security.php
deleted file mode 100644
index 21e18883cc0..00000000000
--- a/lib/private/Settings/Admin/Security.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Robin Appelman <robin@icewind.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OC\Settings\Admin;
-
-use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\Encryption\IManager;
-use OCP\IInitialStateService;
-use OCP\IUserManager;
-use OCP\Settings\ISettings;
-
-class Security implements ISettings {
-
- /** @var IManager */
- private $manager;
-
- /** @var IUserManager */
- private $userManager;
-
- /** @var MandatoryTwoFactor */
- private $mandatoryTwoFactor;
-
- /** @var IInitialStateService */
- private $initialState;
-
- public function __construct(IManager $manager,
- IUserManager $userManager,
- MandatoryTwoFactor $mandatoryTwoFactor,
- IInitialStateService $initialState) {
- $this->manager = $manager;
- $this->userManager = $userManager;
- $this->mandatoryTwoFactor = $mandatoryTwoFactor;
- $this->initialState = $initialState;
- }
-
- /**
- * @return TemplateResponse
- */
- public function getForm() {
- $encryptionModules = $this->manager->getEncryptionModules();
- $defaultEncryptionModuleId = $this->manager->getDefaultEncryptionModuleId();
- $encryptionModuleList = [];
- foreach ($encryptionModules as $module) {
- $encryptionModuleList[$module['id']]['displayName'] = $module['displayName'];
- $encryptionModuleList[$module['id']]['default'] = false;
- if ($module['id'] === $defaultEncryptionModuleId) {
- $encryptionModuleList[$module['id']]['default'] = true;
- }
- }
-
- $this->initialState->provideInitialState(
- 'settings',
- 'mandatory2FAState',
- $this->mandatoryTwoFactor->getState()
- );
-
- $parameters = [
- // Encryption API
- 'encryptionEnabled' => $this->manager->isEnabled(),
- 'encryptionReady' => $this->manager->isReady(),
- 'externalBackendsEnabled' => count($this->userManager->getBackends()) > 1,
- // Modules
- 'encryptionModules' => $encryptionModuleList,
- ];
-
- return new TemplateResponse('settings', 'settings/admin/security', $parameters, '');
- }
-
- /**
- * @return string the section ID, e.g. 'sharing'
- */
- public function getSection() {
- return 'security';
- }
-
- /**
- * @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
- *
- * E.g.: 70
- */
- public function getPriority() {
- return 10;
- }
-}
diff --git a/lib/private/Settings/Admin/Server.php b/lib/private/Settings/Admin/Server.php
deleted file mode 100644
index 1ebea8a4dcd..00000000000
--- a/lib/private/Settings/Admin/Server.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OC\Settings\Admin;
-
-use Doctrine\DBAL\Connection;
-use Doctrine\DBAL\DBALException;
-use Doctrine\DBAL\Platforms\SqlitePlatform;
-use OC\Lock\DBLockingProvider;
-use OC\Lock\NoopLockingProvider;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
-use OCP\IDBConnection;
-use OCP\IL10N;
-use OCP\IRequest;
-use OCP\Lock\ILockingProvider;
-use OCP\Settings\ISettings;
-
-class Server implements ISettings {
- /** @var IDBConnection|Connection */
- private $db;
- /** @var IRequest */
- private $request;
- /** @var IConfig */
- private $config;
- /** @var ILockingProvider */
- private $lockingProvider;
- /** @var IL10N */
- private $l;
-
- /**
- * @param IDBConnection $db
- * @param IRequest $request
- * @param IConfig $config
- * @param ILockingProvider $lockingProvider
- * @param IL10N $l
- */
- public function __construct(IDBConnection $db,
- IRequest $request,
- IConfig $config,
- ILockingProvider $lockingProvider,
- IL10N $l) {
- $this->db = $db;
- $this->request = $request;
- $this->config = $config;
- $this->lockingProvider = $lockingProvider;
- $this->l = $l;
- }
-
- /**
- * @return TemplateResponse
- */
- public function getForm() {
- $parameters = [
- // Background jobs
- 'backgroundjobs_mode' => $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax'),
- 'lastcron' => $this->config->getAppValue('core', 'lastcron', false),
- 'cronErrors' => $this->config->getAppValue('core', 'cronErrors'),
- 'cli_based_cron_possible' => function_exists('posix_getpwuid'),
- 'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '',
- ];
-
- return new TemplateResponse('settings', 'settings/admin/server', $parameters, '');
- }
-
- /**
- * @return string the section ID, e.g. 'sharing'
- */
- public function getSection() {
- return 'server';
- }
-
- /**
- * @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
- *
- * E.g.: 70
- */
- public function getPriority() {
- return 0;
- }
-}
diff --git a/lib/private/Settings/Admin/Sharing.php b/lib/private/Settings/Admin/Sharing.php
deleted file mode 100644
index a044d314b04..00000000000
--- a/lib/private/Settings/Admin/Sharing.php
+++ /dev/null
@@ -1,137 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OC\Settings\Admin;
-
-use OC\Share\Share;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\Constants;
-use OCP\IConfig;
-use OCP\IL10N;
-use OCP\L10N\IFactory;
-use OCP\Settings\ISettings;
-use OCP\Share\IManager;
-use OCP\Util;
-
-class Sharing implements ISettings {
- /** @var IConfig */
- private $config;
-
- /** @var IL10N */
- private $l;
-
- /** @var IManager */
- private $shareManager;
-
- /**
- * @param IConfig $config
- */
- public function __construct(IConfig $config, IFactory $l, IManager $shareManager) {
- $this->config = $config;
- $this->l = $l->get('lib');
- $this->shareManager = $shareManager;
- }
-
- /**
- * @return TemplateResponse
- */
- public function getForm() {
- $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '');
- $excludeGroupsList = !is_null(json_decode($excludedGroups))
- ? implode('|', json_decode($excludedGroups, true)) : '';
-
- $parameters = [
- // Built-In Sharing
- 'allowGroupSharing' => $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes'),
- 'allowLinks' => $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'),
- 'allowPublicUpload' => $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'),
- 'allowResharing' => $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes'),
- 'allowShareDialogUserEnumeration' => $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes'),
- 'enforceLinkPassword' => Util::isPublicLinkPasswordRequired(),
- 'onlyShareWithGroupMembers' => $this->shareManager->shareWithGroupMembersOnly(),
- 'shareAPIEnabled' => $this->config->getAppValue('core', 'shareapi_enabled', 'yes'),
- 'shareDefaultExpireDateSet' => $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no'),
- 'shareExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'),
- 'shareEnforceExpireDate' => $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'),
- 'shareExcludeGroups' => $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes',
- 'shareExcludedGroupsList' => $excludeGroupsList,
- 'publicShareDisclaimerText' => $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null),
- 'enableLinkPasswordByDefault' => $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'),
- 'shareApiDefaultPermissions' => $this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL),
- 'shareApiDefaultPermissionsCheckboxes' => $this->getSharePermissionList(),
- ];
-
- return new TemplateResponse('settings', 'settings/admin/sharing', $parameters, '');
- }
-
- /**
- * get share permission list for template
- *
- * @return array
- */
- private function getSharePermissionList() {
- return [
- [
- 'id' => 'cancreate',
- 'label' => $this->l->t('Create'),
- 'value' => Constants::PERMISSION_CREATE
- ],
- [
- 'id' => 'canupdate',
- 'label' => $this->l->t('Change'),
- 'value' => Constants::PERMISSION_UPDATE
- ],
- [
- 'id' => 'candelete',
- 'label' => $this->l->t('Delete'),
- 'value' => Constants::PERMISSION_DELETE
- ],
- [
- 'id' => 'canshare',
- 'label' => $this->l->t('Share'),
- 'value' => Constants::PERMISSION_SHARE
- ],
- ];
- }
-
- /**
- * @return string the section ID, e.g. 'sharing'
- */
- public function getSection() {
- return 'sharing';
- }
-
- /**
- * @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
- *
- * E.g.: 70
- */
- public function getPriority() {
- return 0;
- }
-}
diff --git a/lib/private/Settings/Personal/Additional.php b/lib/private/Settings/Personal/Additional.php
deleted file mode 100644
index b2bb26dc6bf..00000000000
--- a/lib/private/Settings/Personal/Additional.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OC\Settings\Personal;
-
-
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\Settings\ISettings;
-
-class Additional implements ISettings {
-
- /**
- * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
- * @since 9.1
- */
- public function getForm() {
- return new TemplateResponse('settings', 'settings/empty');
- }
-
- /**
- * @return string the section ID, e.g. 'sharing'
- * @since 9.1
- */
- public function getSection() {
- return 'additional';
- }
-
- /**
- * @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
- *
- * E.g.: 70
- * @since 9.1
- */
- public function getPriority() {
- return '5';
- }
-}
diff --git a/lib/private/Settings/Personal/PersonalInfo.php b/lib/private/Settings/Personal/PersonalInfo.php
deleted file mode 100644
index 98991ce6d40..00000000000
--- a/lib/private/Settings/Personal/PersonalInfo.php
+++ /dev/null
@@ -1,280 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Thomas Citharel <tcit@tcit.fr>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OC\Settings\Personal;
-
-use OC\Accounts\AccountManager;
-use OCA\FederatedFileSharing\AppInfo\Application;
-use OCP\App\IAppManager;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\Files\FileInfo;
-use OCP\IConfig;
-use OCP\IGroup;
-use OCP\IGroupManager;
-use OCP\IL10N;
-use OCP\IUser;
-use OCP\IUserManager;
-use OCP\L10N\IFactory;
-use OCP\Settings\ISettings;
-
-class PersonalInfo implements ISettings {
-
- /** @var IConfig */
- private $config;
- /** @var IUserManager */
- private $userManager;
- /** @var AccountManager */
- private $accountManager;
- /** @var IGroupManager */
- private $groupManager;
- /** @var IAppManager */
- private $appManager;
- /** @var IFactory */
- private $l10nFactory;
- /** @var IL10N */
- private $l;
-
- /**
- * @param IConfig $config
- * @param IUserManager $userManager
- * @param IGroupManager $groupManager
- * @param AccountManager $accountManager
- * @param IFactory $l10nFactory
- * @param IL10N $l
- */
- public function __construct(
- IConfig $config,
- IUserManager $userManager,
- IGroupManager $groupManager,
- AccountManager $accountManager,
- IAppManager $appManager,
- IFactory $l10nFactory,
- IL10N $l
- ) {
- $this->config = $config;
- $this->userManager = $userManager;
- $this->accountManager = $accountManager;
- $this->groupManager = $groupManager;
- $this->appManager = $appManager;
- $this->l10nFactory = $l10nFactory;
- $this->l = $l;
- }
-
- /**
- * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
- * @since 9.1
- */
- public function getForm() {
- $federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing');
- $lookupServerUploadEnabled = false;
- if($federatedFileSharingEnabled) {
- $federatedFileSharing = new Application();
- $shareProvider = $federatedFileSharing->getFederatedShareProvider();
- $lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled();
- }
-
- $uid = \OC_User::getUser();
- $user = $this->userManager->get($uid);
- $userData = $this->accountManager->getUser($user);
-
- $storageInfo = \OC_Helper::getStorageInfo('/');
- if ($storageInfo['quota'] === FileInfo::SPACE_UNLIMITED) {
- $totalSpace = $this->l->t('Unlimited');
- } else {
- $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
- }
-
- $languageParameters = $this->getLanguages($user);
- $localeParameters = $this->getLocales($user);
- $messageParameters = $this->getMessageParameters($userData);
-
- $parameters = [
- 'total_space' => $totalSpace,
- 'usage' => \OC_Helper::humanFileSize($storageInfo['used']),
- 'usage_relative' => round($storageInfo['relative']),
- 'quota' => $storageInfo['quota'],
- 'avatarChangeSupported' => $user->canChangeAvatar(),
- 'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
- 'avatarScope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'],
- 'displayNameChangeSupported' => $user->canChangeDisplayName(),
- 'displayName' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['value'],
- 'displayNameScope' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['scope'],
- 'email' => $userData[AccountManager::PROPERTY_EMAIL]['value'],
- 'emailScope' => $userData[AccountManager::PROPERTY_EMAIL]['scope'],
- 'emailVerification' => $userData[AccountManager::PROPERTY_EMAIL]['verified'],
- 'phone' => $userData[AccountManager::PROPERTY_PHONE]['value'],
- 'phoneScope' => $userData[AccountManager::PROPERTY_PHONE]['scope'],
- 'address' => $userData[AccountManager::PROPERTY_ADDRESS]['value'],
- 'addressScope' => $userData[AccountManager::PROPERTY_ADDRESS]['scope'],
- 'website' => $userData[AccountManager::PROPERTY_WEBSITE]['value'],
- 'websiteScope' => $userData[AccountManager::PROPERTY_WEBSITE]['scope'],
- 'websiteVerification' => $userData[AccountManager::PROPERTY_WEBSITE]['verified'],
- 'twitter' => $userData[AccountManager::PROPERTY_TWITTER]['value'],
- 'twitterScope' => $userData[AccountManager::PROPERTY_TWITTER]['scope'],
- 'twitterVerification' => $userData[AccountManager::PROPERTY_TWITTER]['verified'],
- 'groups' => $this->getGroups($user),
- ] + $messageParameters + $languageParameters + $localeParameters;
-
-
- return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, '');
- }
-
- /**
- * @return string the section ID, e.g. 'sharing'
- * @since 9.1
- */
- public function getSection() {
- return 'personal-info';
- }
-
- /**
- * @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
- *
- * E.g.: 70
- * @since 9.1
- */
- public function getPriority() {
- return 10;
- }
-
- /**
- * returns a sorted list of the user's group GIDs
- *
- * @param IUser $user
- * @return array
- */
- private function getGroups(IUser $user) {
- $groups = array_map(
- function(IGroup $group) {
- return $group->getDisplayName();
- },
- $this->groupManager->getUserGroups($user)
- );
- sort($groups);
-
- return $groups;
- }
-
- /**
- * returns the user language, common language and other languages in an
- * associative array
- *
- * @param IUser $user
- * @return array
- */
- private function getLanguages(IUser $user) {
- $forceLanguage = $this->config->getSystemValue('force_language', false);
- if($forceLanguage !== false) {
- return [];
- }
-
- $uid = $user->getUID();
-
- $userConfLang = $this->config->getUserValue($uid, 'core', 'lang', $this->l10nFactory->findLanguage());
- $languages = $this->l10nFactory->getLanguages();
-
- // associate the user language with the proper array
- $userLangIndex = array_search($userConfLang, array_column($languages['commonlanguages'], 'code'));
- $userLang = $languages['commonlanguages'][$userLangIndex];
- // search in the other languages
- if ($userLangIndex === false) {
- $userLangIndex = array_search($userConfLang, array_column($languages['languages'], 'code'));
- $userLang = $languages['languages'][$userLangIndex];
- }
- // if user language is not available but set somehow: show the actual code as name
- if (!is_array($userLang)) {
- $userLang = [
- 'code' => $userConfLang,
- 'name' => $userConfLang,
- ];
- }
-
- return array_merge(
- array('activelanguage' => $userLang),
- $languages
- );
- }
-
- private function getLocales(IUser $user) {
- $forceLanguage = $this->config->getSystemValue('force_locale', false);
- if($forceLanguage !== false) {
- return [];
- }
-
- $uid = $user->getUID();
-
- $userLocaleString = $this->config->getUserValue($uid, 'core', 'locale', $this->l10nFactory->findLocale());
-
- $userLang = $this->config->getUserValue($uid, 'core', 'lang', $this->l10nFactory->findLanguage());
-
- $localeCodes = $this->l10nFactory->findAvailableLocales();
-
- $userLocale = array_filter($localeCodes, function($value) use ($userLocaleString) {
- return $userLocaleString === $value['code'];
- });
-
- if (!empty($userLocale))
- {
- $userLocale = reset($userLocale);
- }
-
- $localesForLanguage = array_filter($localeCodes, function($localeCode) use ($userLang) {
- return 0 === strpos($localeCode['code'], $userLang);
- });
-
- return [
- 'activelocaleLang' => $userLocaleString,
- 'activelocale' => $userLocale,
- 'locales' => $localeCodes,
- 'localesForLanguage' => $localesForLanguage,
- ];
- }
-
- /**
- * @param array $userData
- * @return array
- */
- private function getMessageParameters(array $userData) {
- $needVerifyMessage = [AccountManager::PROPERTY_EMAIL, AccountManager::PROPERTY_WEBSITE, AccountManager::PROPERTY_TWITTER];
- $messageParameters = [];
- foreach ($needVerifyMessage as $property) {
- switch ($userData[$property]['verified']) {
- case AccountManager::VERIFIED:
- $message = $this->l->t('Verifying');
- break;
- case AccountManager::VERIFICATION_IN_PROGRESS:
- $message = $this->l->t('Verifying …');
- break;
- default:
- $message = $this->l->t('Verify');
- }
- $messageParameters[$property . 'Message'] = $message;
- }
- return $messageParameters;
- }
-
-}
diff --git a/lib/private/Settings/Personal/Security.php b/lib/private/Settings/Personal/Security.php
deleted file mode 100644
index a009c6a12f4..00000000000
--- a/lib/private/Settings/Personal/Security.php
+++ /dev/null
@@ -1,188 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OC\Settings\Personal;
-
-
-use function array_filter;
-use function array_map;
-use function is_null;
-use OC\Authentication\Exceptions\InvalidTokenException;
-use OC\Authentication\Token\INamedToken;
-use OC\Authentication\Token\IProvider as IAuthTokenProvider;
-use OC\Authentication\Token\IToken;
-use OC\Authentication\TwoFactorAuth\Manager as TwoFactorManager;
-use OC\Authentication\TwoFactorAuth\ProviderLoader;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\Authentication\TwoFactorAuth\IProvider;
-use OCP\Authentication\TwoFactorAuth\IProvidesPersonalSettings;
-use OCP\IInitialStateService;
-use OCP\ISession;
-use OCP\IUserManager;
-use OCP\IUserSession;
-use OCP\Session\Exceptions\SessionNotAvailableException;
-use OCP\Settings\ISettings;
-use OCP\IConfig;
-
-class Security implements ISettings {
-
- /** @var IUserManager */
- private $userManager;
-
- /** @var TwoFactorManager */
- private $twoFactorManager;
-
- /** @var IAuthTokenProvider */
- private $tokenProvider;
-
- /** @var ProviderLoader */
- private $providerLoader;
-
- /** @var IUserSession */
- private $userSession;
-
- /** @var ISession */
- private $session;
-
- /** @var IInitialStateService */
- private $initialStateService;
- /**
- * @var string|null
- */
- private $uid;
- /**
- *@var IConfig
- */
- private $config;
-
- public function __construct(IUserManager $userManager,
- TwoFactorManager $providerManager,
- IAuthTokenProvider $tokenProvider,
- ProviderLoader $providerLoader,
- IUserSession $userSession,
- ISession $session,
- IConfig $config,
- IInitialStateService $initialStateService,
- ?string $UserId) {
- $this->userManager = $userManager;
- $this->twoFactorManager = $providerManager;
- $this->tokenProvider = $tokenProvider;
- $this->providerLoader = $providerLoader;
- $this->userSession = $userSession;
- $this->session = $session;
- $this->initialStateService = $initialStateService;
- $this->uid = $UserId;
- $this->config = $config;
- }
-
- /**
- * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
- * @since 9.1
- */
- public function getForm() {
- $user = $this->userManager->get($this->uid);
- $passwordChangeSupported = false;
- if ($user !== null) {
- $passwordChangeSupported = $user->canChangePassword();
- }
-
- $this->initialStateService->provideInitialState(
- 'settings',
- 'app_tokens',
- $this->getAppTokens()
- );
-
- return new TemplateResponse('settings', 'settings/personal/security', [
- 'passwordChangeSupported' => $passwordChangeSupported,
- 'twoFactorProviderData' => $this->getTwoFactorProviderData(),
- 'themedark' => $this->config->getUserValue($this->uid, 'accessibility', 'theme', false)
- ]);
- }
-
- /**
- * @return string the section ID, e.g. 'sharing'
- * @since 9.1
- */
- public function getSection() {
- return 'security';
- }
-
- /**
- * @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
- *
- * E.g.: 70
- * @since 9.1
- */
- public function getPriority() {
- return 10;
- }
-
- private function getTwoFactorProviderData(): array {
- $user = $this->userSession->getUser();
- if (is_null($user)) {
- // Actually impossible, but still …
- return [];
- }
-
- return [
- 'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) {
- return [
- 'provider' => $provider,
- 'settings' => $provider->getPersonalSettings($user)
- ];
- }, array_filter($this->providerLoader->getProviders($user), function (IProvider $provider) {
- return $provider instanceof IProvidesPersonalSettings;
- }))
- ];
- }
-
- private function getAppTokens(): array {
- $tokens = $this->tokenProvider->getTokenByUser($this->uid);
-
- try {
- $sessionId = $this->session->getId();
- } catch (SessionNotAvailableException $ex) {
- return [];
- }
- try {
- $sessionToken = $this->tokenProvider->getToken($sessionId);
- } catch (InvalidTokenException $ex) {
- return [];
- }
-
- return array_map(function (IToken $token) use ($sessionToken) {
- $data = $token->jsonSerialize();
- $data['canDelete'] = true;
- $data['canRename'] = $token instanceof INamedToken;
- if ($sessionToken->getId() === $token->getId()) {
- $data['canDelete'] = false;
- $data['canRename'] = false;
- $data['current'] = true;
- }
- return $data;
- }, $tokens);
- }
-
-}
diff --git a/lib/private/Settings/Personal/ServerDevNotice.php b/lib/private/Settings/Personal/ServerDevNotice.php
deleted file mode 100644
index fa5a736cded..00000000000
--- a/lib/private/Settings/Personal/ServerDevNotice.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/**
- * @copyright 2016, Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-namespace OC\Settings\Personal;
-
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\Settings\ISettings;
-
-class ServerDevNotice implements ISettings {
- /**
- * @return TemplateResponse
- */
- public function getForm() {
- return new TemplateResponse('settings', 'settings/personal/development.notice');
- }
-
- /**
- * @return string the section ID, e.g. 'sharing'
- */
- public function getSection() {
- return 'personal-info';
- }
-
- /**
- * @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
- *
- * E.g.: 70
- */
- public function getPriority() {
- return 1000;
- }
-}