Merge pull request #19168 from nextcloud/enh/settings/personal_sections_to_proper_app
Move the Personal sections to the settings app
This commit is contained in:
commit
74f1b09f3d
|
@ -16,4 +16,10 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<nextcloud min-version="19" max-version="19"/>
|
<nextcloud min-version="19" max-version="19"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<settings>
|
||||||
|
<personal-section>OCA\Settings\Sections\Personal\PersonalInfo</personal-section>
|
||||||
|
<personal-section>OCA\Settings\Sections\Personal\Security</personal-section>
|
||||||
|
<personal-section>OCA\Settings\Sections\Personal\SyncClients</personal-section>
|
||||||
|
</settings>
|
||||||
</info>
|
</info>
|
||||||
|
|
|
@ -41,4 +41,7 @@ return array(
|
||||||
'OCA\\Settings\\Personal\\Security' => $baseDir . '/../lib/Settings/Personal/Security.php',
|
'OCA\\Settings\\Personal\\Security' => $baseDir . '/../lib/Settings/Personal/Security.php',
|
||||||
'OCA\\Settings\\Personal\\Security\\Authtokens' => $baseDir . '/../lib/Settings/Personal/Security/Authtokens.php',
|
'OCA\\Settings\\Personal\\Security\\Authtokens' => $baseDir . '/../lib/Settings/Personal/Security/Authtokens.php',
|
||||||
'OCA\\Settings\\Personal\\ServerDevNotice' => $baseDir . '/../lib/Settings/Personal/ServerDevNotice.php',
|
'OCA\\Settings\\Personal\\ServerDevNotice' => $baseDir . '/../lib/Settings/Personal/ServerDevNotice.php',
|
||||||
|
'OCA\\Settings\\Sections\\Personal\\PersonalInfo' => $baseDir . '/../lib/Sections/Personal/PersonalInfo.php',
|
||||||
|
'OCA\\Settings\\Sections\\Personal\\Security' => $baseDir . '/../lib/Sections/Personal/Security.php',
|
||||||
|
'OCA\\Settings\\Sections\\Personal\\SyncClients' => $baseDir . '/../lib/Sections/Personal/SyncClients.php',
|
||||||
);
|
);
|
||||||
|
|
|
@ -56,6 +56,9 @@ class ComposerStaticInitSettings
|
||||||
'OCA\\Settings\\Personal\\Security' => __DIR__ . '/..' . '/../lib/Settings/Personal/Security.php',
|
'OCA\\Settings\\Personal\\Security' => __DIR__ . '/..' . '/../lib/Settings/Personal/Security.php',
|
||||||
'OCA\\Settings\\Personal\\Security\\Authtokens' => __DIR__ . '/..' . '/../lib/Settings/Personal/Security/Authtokens.php',
|
'OCA\\Settings\\Personal\\Security\\Authtokens' => __DIR__ . '/..' . '/../lib/Settings/Personal/Security/Authtokens.php',
|
||||||
'OCA\\Settings\\Personal\\ServerDevNotice' => __DIR__ . '/..' . '/../lib/Settings/Personal/ServerDevNotice.php',
|
'OCA\\Settings\\Personal\\ServerDevNotice' => __DIR__ . '/..' . '/../lib/Settings/Personal/ServerDevNotice.php',
|
||||||
|
'OCA\\Settings\\Sections\\Personal\\PersonalInfo' => __DIR__ . '/..' . '/../lib/Sections/Personal/PersonalInfo.php',
|
||||||
|
'OCA\\Settings\\Sections\\Personal\\Security' => __DIR__ . '/..' . '/../lib/Sections/Personal/Security.php',
|
||||||
|
'OCA\\Settings\\Sections\\Personal\\SyncClients' => __DIR__ . '/..' . '/../lib/Sections/Personal/SyncClients.php',
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function getInitializer(ClassLoader $loader)
|
public static function getInitializer(ClassLoader $loader)
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl>
|
||||||
|
*
|
||||||
|
* @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 OCA\Settings\Sections\Personal;
|
||||||
|
|
||||||
|
use OCP\IL10N;
|
||||||
|
use OCP\IURLGenerator;
|
||||||
|
use OCP\Settings\IIconSection;
|
||||||
|
|
||||||
|
class PersonalInfo implements IIconSection {
|
||||||
|
|
||||||
|
/** @var IL10N */
|
||||||
|
private $l;
|
||||||
|
|
||||||
|
/** @var IURLGenerator */
|
||||||
|
private $urlGenerator;
|
||||||
|
|
||||||
|
public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
|
||||||
|
$this->l = $l;
|
||||||
|
$this->urlGenerator = $urlGenerator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIcon() {
|
||||||
|
return $this->urlGenerator->imagePath('core', 'actions/user.svg');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getID(): string {
|
||||||
|
return 'personal-info';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(): string {
|
||||||
|
return $this->l->t('Personal info');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPriority(): int {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl>
|
||||||
|
*
|
||||||
|
* @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 OCA\Settings\Sections\Personal;
|
||||||
|
|
||||||
|
use OCP\IL10N;
|
||||||
|
use OCP\IURLGenerator;
|
||||||
|
use OCP\Settings\IIconSection;
|
||||||
|
|
||||||
|
class Security implements IIconSection {
|
||||||
|
|
||||||
|
/** @var IL10N */
|
||||||
|
private $l;
|
||||||
|
|
||||||
|
/** @var IURLGenerator */
|
||||||
|
private $urlGenerator;
|
||||||
|
|
||||||
|
public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
|
||||||
|
$this->l = $l;
|
||||||
|
$this->urlGenerator = $urlGenerator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIcon() {
|
||||||
|
return $this->urlGenerator->imagePath('settings', 'password.svg');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getID(): string {
|
||||||
|
return 'security';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(): string {
|
||||||
|
return $this->l->t('Security');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPriority(): int {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl>
|
||||||
|
*
|
||||||
|
* @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 OCA\Settings\Sections\Personal;
|
||||||
|
|
||||||
|
use OCP\IL10N;
|
||||||
|
use OCP\IURLGenerator;
|
||||||
|
use OCP\Settings\IIconSection;
|
||||||
|
|
||||||
|
class SyncClients implements IIconSection {
|
||||||
|
|
||||||
|
/** @var IL10N */
|
||||||
|
private $l;
|
||||||
|
|
||||||
|
/** @var IURLGenerator */
|
||||||
|
private $urlGenerator;
|
||||||
|
|
||||||
|
public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
|
||||||
|
$this->l = $l;
|
||||||
|
$this->urlGenerator = $urlGenerator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIcon() {
|
||||||
|
return $this->urlGenerator->imagePath('core', 'clients/phone.svg');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getID(): string {
|
||||||
|
return 'sync-clients';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(): string {
|
||||||
|
return $this->l->t('Mobile & desktop');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPriority(): int {
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
}
|
|
@ -350,11 +350,7 @@ class Manager implements IManager {
|
||||||
$this->l = $this->l10nFactory->get('lib');
|
$this->l = $this->l10nFactory->get('lib');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sections = [
|
$sections = [];
|
||||||
0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/user.svg'))],
|
|
||||||
5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],
|
|
||||||
15 => [new Section('sync-clients', $this->l->t('Mobile & desktop'), 0, $this->url->imagePath('core', 'clients/phone.svg'))],
|
|
||||||
];
|
|
||||||
|
|
||||||
$legacyForms = \OC_App::getForms('personal');
|
$legacyForms = \OC_App::getForms('personal');
|
||||||
if (!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
|
if (!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
|
||||||
|
|
|
@ -116,18 +116,7 @@ class ManagerTest extends TestCase {
|
||||||
|
|
||||||
$this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class);
|
$this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class);
|
||||||
|
|
||||||
$this->url->expects($this->exactly(3))
|
|
||||||
->method('imagePath')
|
|
||||||
->willReturnMap([
|
|
||||||
['core', 'actions/user.svg', '1'],
|
|
||||||
['settings', 'password.svg', '2'],
|
|
||||||
['core', 'clients/phone.svg', '3'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
0 => [new Section('personal-info', 'Personal info', 0, '1')],
|
|
||||||
5 => [new Section('security', 'Security', 0, '2')],
|
|
||||||
15 => [new Section('sync-clients', 'Mobile & desktop', 0, '3')],
|
|
||||||
55 => [\OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class)],
|
55 => [\OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class)],
|
||||||
], $this->manager->getPersonalSections());
|
], $this->manager->getPersonalSections());
|
||||||
}
|
}
|
||||||
|
@ -175,19 +164,7 @@ class ManagerTest extends TestCase {
|
||||||
->method('t')
|
->method('t')
|
||||||
->will($this->returnArgument(0));
|
->will($this->returnArgument(0));
|
||||||
|
|
||||||
$this->url->expects($this->exactly(3))
|
$this->assertEquals([], $this->manager->getPersonalSections());
|
||||||
->method('imagePath')
|
|
||||||
->willReturnMap([
|
|
||||||
['core', 'actions/user.svg', '1'],
|
|
||||||
['settings', 'password.svg', '2'],
|
|
||||||
['core', 'clients/phone.svg', '3'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->assertArraySubset([
|
|
||||||
0 => [new Section('personal-info', 'Personal info', 0, '1')],
|
|
||||||
5 => [new Section('security', 'Security', 0, '2')],
|
|
||||||
15 => [new Section('sync-clients', 'Mobile & desktop', 0, '3')],
|
|
||||||
], $this->manager->getPersonalSections());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAdminSettings() {
|
public function testGetAdminSettings() {
|
||||||
|
@ -276,7 +253,7 @@ class ManagerTest extends TestCase {
|
||||||
$this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class);
|
$this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class);
|
||||||
$this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class);
|
$this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class);
|
||||||
|
|
||||||
$this->url->expects($this->exactly(9))
|
$this->url->expects($this->exactly(6))
|
||||||
->method('imagePath')
|
->method('imagePath')
|
||||||
->willReturnMap([
|
->willReturnMap([
|
||||||
['core', 'actions/user.svg', '1'],
|
['core', 'actions/user.svg', '1'],
|
||||||
|
@ -291,9 +268,6 @@ class ManagerTest extends TestCase {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
0 => [new Section('personal-info', 'Personal info', 0, '1')],
|
|
||||||
5 => [new Section('security', 'Security', 0, '2')],
|
|
||||||
15 => [new Section('sync-clients', 'Mobile & desktop', 0, '3')],
|
|
||||||
55 => [\OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class)],
|
55 => [\OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class)],
|
||||||
], $this->manager->getPersonalSections());
|
], $this->manager->getPersonalSections());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue