Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>tags/v19.0.0beta1
@@ -18,6 +18,12 @@ | |||
</dependencies> | |||
<settings> | |||
<admin-section>OCA\Settings\Sections\Admin\Additional</admin-section> | |||
<admin-section>OCA\Settings\Sections\Admin\Groupware</admin-section> | |||
<admin-section>OCA\Settings\Sections\Admin\Overview</admin-section> | |||
<admin-section>OCA\Settings\Sections\Admin\Security</admin-section> | |||
<admin-section>OCA\Settings\Sections\Admin\Server</admin-section> | |||
<admin-section>OCA\Settings\Sections\Admin\Sharing</admin-section> | |||
<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> |
@@ -41,6 +41,12 @@ return array( | |||
'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\\ServerDevNotice' => $baseDir . '/../lib/Settings/Personal/ServerDevNotice.php', | |||
'OCA\\Settings\\Sections\\Admin\\Additional' => $baseDir . '/../lib/Sections/Admin/Additional.php', | |||
'OCA\\Settings\\Sections\\Admin\\Groupware' => $baseDir . '/../lib/Sections/Admin/Groupware.php', | |||
'OCA\\Settings\\Sections\\Admin\\Overview' => $baseDir . '/../lib/Sections/Admin/Overview.php', | |||
'OCA\\Settings\\Sections\\Admin\\Security' => $baseDir . '/../lib/Sections/Admin/Security.php', | |||
'OCA\\Settings\\Sections\\Admin\\Server' => $baseDir . '/../lib/Sections/Admin/Server.php', | |||
'OCA\\Settings\\Sections\\Admin\\Sharing' => $baseDir . '/../lib/Sections/Admin/Sharing.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,12 @@ class ComposerStaticInitSettings | |||
'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\\ServerDevNotice' => __DIR__ . '/..' . '/../lib/Settings/Personal/ServerDevNotice.php', | |||
'OCA\\Settings\\Sections\\Admin\\Additional' => __DIR__ . '/..' . '/../lib/Sections/Admin/Additional.php', | |||
'OCA\\Settings\\Sections\\Admin\\Groupware' => __DIR__ . '/..' . '/../lib/Sections/Admin/Groupware.php', | |||
'OCA\\Settings\\Sections\\Admin\\Overview' => __DIR__ . '/..' . '/../lib/Sections/Admin/Overview.php', | |||
'OCA\\Settings\\Sections\\Admin\\Security' => __DIR__ . '/..' . '/../lib/Sections/Admin/Security.php', | |||
'OCA\\Settings\\Sections\\Admin\\Server' => __DIR__ . '/..' . '/../lib/Sections/Admin/Server.php', | |||
'OCA\\Settings\\Sections\\Admin\\Sharing' => __DIR__ . '/..' . '/../lib/Sections/Admin/Sharing.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', |
@@ -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\Admin; | |||
use OCP\IL10N; | |||
use OCP\IURLGenerator; | |||
use OCP\Settings\IIconSection; | |||
class Additional 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(): string { | |||
return $this->urlGenerator->imagePath('core', 'actions/settings-dark.svg'); | |||
} | |||
public function getID(): string { | |||
return 'additional'; | |||
} | |||
public function getName(): string { | |||
return $this->l->t('Additional settings'); | |||
} | |||
public function getPriority(): int { | |||
return 98; | |||
} | |||
} |
@@ -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\Admin; | |||
use OCP\IL10N; | |||
use OCP\IURLGenerator; | |||
use OCP\Settings\IIconSection; | |||
class Groupware 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(): string { | |||
return $this->urlGenerator->imagePath('core', 'places/contacts.svg'); | |||
} | |||
public function getID(): string { | |||
return 'groupware'; | |||
} | |||
public function getName(): string { | |||
return $this->l->t('Groupware'); | |||
} | |||
public function getPriority(): int { | |||
return 50; | |||
} | |||
} |
@@ -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\Admin; | |||
use OCP\IL10N; | |||
use OCP\IURLGenerator; | |||
use OCP\Settings\IIconSection; | |||
class Overview 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(): string { | |||
return $this->urlGenerator->imagePath('settings', 'admin.svg'); | |||
} | |||
public function getID(): string { | |||
return 'overview'; | |||
} | |||
public function getName(): string { | |||
return $this->l->t('Overview'); | |||
} | |||
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\Admin; | |||
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(): string { | |||
return $this->urlGenerator->imagePath('core', 'actions/password.svg'); | |||
} | |||
public function getID(): string { | |||
return 'security'; | |||
} | |||
public function getName(): string { | |||
return $this->l->t('Security'); | |||
} | |||
public function getPriority(): int { | |||
return 10; | |||
} | |||
} |
@@ -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\Admin; | |||
use OCP\IL10N; | |||
use OCP\IURLGenerator; | |||
use OCP\Settings\IIconSection; | |||
class Server 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(): string { | |||
return $this->urlGenerator->imagePath('core', 'actions/settings-dark.svg'); | |||
} | |||
public function getID(): string { | |||
return 'server'; | |||
} | |||
public function getName(): string { | |||
return $this->l->t('Basic settings'); | |||
} | |||
public function getPriority(): int { | |||
return 1; | |||
} | |||
} |
@@ -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\Admin; | |||
use OCP\IL10N; | |||
use OCP\IURLGenerator; | |||
use OCP\Settings\IIconSection; | |||
class Sharing 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(): string { | |||
return $this->urlGenerator->imagePath('core', 'actions/share.svg'); | |||
} | |||
public function getID(): string { | |||
return 'sharing'; | |||
} | |||
public function getName(): string { | |||
return $this->l->t('Sharing'); | |||
} | |||
public function getPriority(): int { | |||
return 5; | |||
} | |||
} |
@@ -208,19 +208,8 @@ class Manager implements IManager { | |||
* @inheritdoc | |||
*/ | |||
public function getAdminSections(): array { | |||
if ($this->l === null) { | |||
$this->l = $this->l10nFactory->get('lib'); | |||
} | |||
// built-in sections | |||
$sections = [ | |||
0 => [new Section('overview', $this->l->t('Overview'), 0, $this->url->imagePath('settings', 'admin.svg'))], | |||
1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], | |||
5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))], | |||
10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))], | |||
50 => [new Section('groupware', $this->l->t('Groupware'), 0, $this->url->imagePath('core', 'places/contacts.svg'))], | |||
98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], | |||
]; | |||
$sections = []; | |||
$appSections = $this->getSections('admin'); | |||
@@ -69,51 +69,14 @@ class ManagerTest extends TestCase { | |||
} | |||
public function testGetAdminSections() { | |||
$this->l10nFactory | |||
->expects($this->once()) | |||
->method('get') | |||
->with('lib') | |||
->willReturn($this->l10n); | |||
$this->l10n | |||
->expects($this->any()) | |||
->method('t') | |||
->will($this->returnArgument(0)); | |||
$this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class); | |||
$this->url->expects($this->exactly(6)) | |||
->method('imagePath') | |||
->willReturnMap([ | |||
['settings', 'admin.svg', '0'], | |||
['core', 'actions/settings-dark.svg', '1'], | |||
['core', 'actions/share.svg', '2'], | |||
['core', 'actions/password.svg', '3'], | |||
['core', 'places/contacts.svg', '5'], | |||
['settings', 'help.svg', '4'], | |||
]); | |||
$this->assertEquals([ | |||
0 => [new Section('overview', 'Overview', 0, '0')], | |||
1 => [new Section('server', 'Basic settings', 0, '1')], | |||
5 => [new Section('sharing', 'Sharing', 0, '2')], | |||
10 => [new Section('security', 'Security', 0, '3')], | |||
50 => [new Section('groupware', 'Groupware', 0, '5')], | |||
55 => [\OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class)], | |||
98 => [new Section('additional', 'Additional settings', 0, '1')], | |||
], $this->manager->getAdminSections()); | |||
} | |||
public function testGetPersonalSections() { | |||
$this->l10nFactory | |||
->expects($this->once()) | |||
->method('get') | |||
->with('lib') | |||
->willReturn($this->l10n); | |||
$this->l10n | |||
->expects($this->any()) | |||
->method('t') | |||
->will($this->returnArgument(0)); | |||
$this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class); | |||
$this->assertEquals([ | |||
@@ -122,35 +85,7 @@ class ManagerTest extends TestCase { | |||
} | |||
public function testGetAdminSectionsEmptySection() { | |||
$this->l10nFactory | |||
->expects($this->once()) | |||
->method('get') | |||
->with('lib') | |||
->willReturn($this->l10n); | |||
$this->l10n | |||
->expects($this->any()) | |||
->method('t') | |||
->will($this->returnArgument(0)); | |||
$this->url->expects($this->exactly(6)) | |||
->method('imagePath') | |||
->willReturnMap([ | |||
['settings', 'admin.svg', '0'], | |||
['core', 'actions/settings-dark.svg', '1'], | |||
['core', 'actions/share.svg', '2'], | |||
['core', 'actions/password.svg', '3'], | |||
['core', 'places/contacts.svg', '5'], | |||
['settings', 'help.svg', '4'], | |||
]); | |||
$this->assertEquals([ | |||
0 => [new Section('overview', 'Overview', 0, '0')], | |||
1 => [new Section('server', 'Basic settings', 0, '1')], | |||
5 => [new Section('sharing', 'Sharing', 0, '2')], | |||
10 => [new Section('security', 'Security', 0, '3')], | |||
50 => [new Section('groupware', 'Groupware', 0, '5')], | |||
98 => [new Section('additional', 'Additional settings', 0, '1')], | |||
], $this->manager->getAdminSections()); | |||
$this->assertEquals([], $this->manager->getAdminSections()); | |||
} | |||
public function testGetPersonalSectionsEmptySection() { | |||
@@ -253,32 +188,12 @@ class ManagerTest extends TestCase { | |||
$this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class); | |||
$this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class); | |||
$this->url->expects($this->exactly(6)) | |||
->method('imagePath') | |||
->willReturnMap([ | |||
['core', 'actions/user.svg', '1'], | |||
['settings', 'password.svg', '2'], | |||
['core', 'clients/phone.svg', '3'], | |||
['settings', 'admin.svg', '0'], | |||
['core', 'actions/settings-dark.svg', '1'], | |||
['core', 'actions/share.svg', '2'], | |||
['core', 'actions/password.svg', '3'], | |||
['core', 'places/contacts.svg', '5'], | |||
['settings', 'help.svg', '4'], | |||
]); | |||
$this->assertEquals([ | |||
55 => [\OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class)], | |||
], $this->manager->getPersonalSections()); | |||
$this->assertEquals([ | |||
0 => [new Section('overview', 'Overview', 0, '0')], | |||
1 => [new Section('server', 'Basic settings', 0, '1')], | |||
5 => [new Section('sharing', 'Sharing', 0, '2')], | |||
10 => [new Section('security', 'Security', 0, '3')], | |||
50 => [new Section('groupware', 'Groupware', 0, '5')], | |||
55 => [\OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class)], | |||
98 => [new Section('additional', 'Additional settings', 0, '1')], | |||
], $this->manager->getAdminSections()); | |||
} | |||
} |