</dependencies>
<settings>
+ <admin>OCA\Settings\Settings\Admin\Mail</admin>
+ <admin>OCA\Settings\Settings\Admin\Overview</admin>
+ <admin>OCA\Settings\Settomgs\Admin\Security</admin>
+ <admin>OCA\Settings\Settings\Admin\Server</admin>
+ <admin>OCA\Settings\Settings\Admin\Sharing</admin>
<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>
'OCA\\Settings\\Activity\\SecurityProvider' => $baseDir . '/../lib/Activity/SecurityProvider.php',
'OCA\\Settings\\Activity\\SecuritySetting' => $baseDir . '/../lib/Activity/SecuritySetting.php',
'OCA\\Settings\\Activity\\Setting' => $baseDir . '/../lib/Activity/Setting.php',
- 'OCA\\Settings\\Admin\\Mail' => $baseDir . '/../lib/Settings/Admin/Mail.php',
- 'OCA\\Settings\\Admin\\Overview' => $baseDir . '/../lib/Settings/Admin/Overview.php',
- 'OCA\\Settings\\Admin\\Security' => $baseDir . '/../lib/Settings/Admin/Security.php',
- 'OCA\\Settings\\Admin\\Server' => $baseDir . '/../lib/Settings/Admin/Server.php',
- 'OCA\\Settings\\Admin\\Sharing' => $baseDir . '/../lib/Settings/Admin/Sharing.php',
'OCA\\Settings\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
'OCA\\Settings\\BackgroundJobs\\VerifyUserData' => $baseDir . '/../lib/BackgroundJobs/VerifyUserData.php',
'OCA\\Settings\\Controller\\AdminSettingsController' => $baseDir . '/../lib/Controller/AdminSettingsController.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',
+ 'OCA\\Settings\\Settings\\Admin\\Mail' => $baseDir . '/../lib/Settings/Admin/Mail.php',
+ 'OCA\\Settings\\Settings\\Admin\\Overview' => $baseDir . '/../lib/Settings/Admin/Overview.php',
+ 'OCA\\Settings\\Settings\\Admin\\Security' => $baseDir . '/../lib/Settings/Admin/Security.php',
+ 'OCA\\Settings\\Settings\\Admin\\Server' => $baseDir . '/../lib/Settings/Admin/Server.php',
+ 'OCA\\Settings\\Settings\\Admin\\Sharing' => $baseDir . '/../lib/Settings/Admin/Sharing.php',
'OCA\\Settings\\Settings\\Personal\\Additional' => $baseDir . '/../lib/Settings/Personal/Additional.php',
'OCA\\Settings\\Settings\\Personal\\PersonalInfo' => $baseDir . '/../lib/Settings/Personal/PersonalInfo.php',
'OCA\\Settings\\Settings\\Personal\\Security\\Authtokens' => $baseDir . '/../lib/Settings/Personal/Security/Authtokens.php',
'OCA\\Settings\\Activity\\SecurityProvider' => __DIR__ . '/..' . '/../lib/Activity/SecurityProvider.php',
'OCA\\Settings\\Activity\\SecuritySetting' => __DIR__ . '/..' . '/../lib/Activity/SecuritySetting.php',
'OCA\\Settings\\Activity\\Setting' => __DIR__ . '/..' . '/../lib/Activity/Setting.php',
- 'OCA\\Settings\\Admin\\Mail' => __DIR__ . '/..' . '/../lib/Settings/Admin/Mail.php',
- 'OCA\\Settings\\Admin\\Overview' => __DIR__ . '/..' . '/../lib/Settings/Admin/Overview.php',
- 'OCA\\Settings\\Admin\\Security' => __DIR__ . '/..' . '/../lib/Settings/Admin/Security.php',
- 'OCA\\Settings\\Admin\\Server' => __DIR__ . '/..' . '/../lib/Settings/Admin/Server.php',
- 'OCA\\Settings\\Admin\\Sharing' => __DIR__ . '/..' . '/../lib/Settings/Admin/Sharing.php',
'OCA\\Settings\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
'OCA\\Settings\\BackgroundJobs\\VerifyUserData' => __DIR__ . '/..' . '/../lib/BackgroundJobs/VerifyUserData.php',
'OCA\\Settings\\Controller\\AdminSettingsController' => __DIR__ . '/..' . '/../lib/Controller/AdminSettingsController.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',
+ 'OCA\\Settings\\Settings\\Admin\\Mail' => __DIR__ . '/..' . '/../lib/Settings/Admin/Mail.php',
+ 'OCA\\Settings\\Settings\\Admin\\Overview' => __DIR__ . '/..' . '/../lib/Settings/Admin/Overview.php',
+ 'OCA\\Settings\\Settings\\Admin\\Security' => __DIR__ . '/..' . '/../lib/Settings/Admin/Security.php',
+ 'OCA\\Settings\\Settings\\Admin\\Server' => __DIR__ . '/..' . '/../lib/Settings/Admin/Server.php',
+ 'OCA\\Settings\\Settings\\Admin\\Sharing' => __DIR__ . '/..' . '/../lib/Settings/Admin/Sharing.php',
'OCA\\Settings\\Settings\\Personal\\Additional' => __DIR__ . '/..' . '/../lib/Settings/Personal/Additional.php',
'OCA\\Settings\\Settings\\Personal\\PersonalInfo' => __DIR__ . '/..' . '/../lib/Settings/Personal/PersonalInfo.php',
'OCA\\Settings\\Settings\\Personal\\Security\\Authtokens' => __DIR__ . '/..' . '/../lib/Settings/Personal/Security/Authtokens.php',
*
*/
-namespace OCA\Settings\Admin;
+namespace OCA\Settings\Settings\Admin;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
*
*/
-namespace OCA\Settings\Admin;
+namespace OCA\Settings\Settings\Admin;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
*
*/
-namespace OCA\Settings\Admin;
+namespace OCA\Settings\Settings\Admin;
use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor;
use OCP\AppFramework\Http\TemplateResponse;
*
*/
-namespace OCA\Settings\Admin;
+namespace OCA\Settings\Settings\Admin;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
*
*/
-namespace OCA\Settings\Admin;
+namespace OCA\Settings\Settings\Admin;
use OC\Share\Share;
use OCP\AppFramework\Http\TemplateResponse;
namespace OCA\Settings\Tests\Settings\Admin;
-use OCA\Settings\Admin\Mail;
+use OCA\Settings\Settings\Admin\Mail;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use Test\TestCase;
use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor;
use OC\Encryption\Manager;
-use OCA\Settings\Admin\Security;
+use OCA\Settings\Settings\Admin\Security;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IInitialStateService;
use OCP\IUserManager;
namespace OCA\Settings\Tests\Settings\Admin;
-use OCA\Settings\Admin\Server;
+use OCA\Settings\Settings\Admin\Server;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use Test\TestCase;
namespace OCA\Settings\Tests\Settings\Admin;
-use OCA\Settings\Admin\Sharing;
+use OCA\Settings\Settings\Admin\Sharing;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Constants;
use OCP\IConfig;
return $sections;
}
- /**
- * @param string $section
- * @param Closure $filter
- *
- * @return ISection[]
- */
- private function getBuiltInAdminSettings($section, Closure $filter = null): array {
- $forms = [];
-
- if ($section === 'overview') {
- /** @var ISettings $form */
- $form = $this->container->query(\OCA\Settings\Admin\Overview::class);
- if ($filter === null || $filter($form)) {
- $forms[$form->getPriority()] = [$form];
- }
- }
- if ($section === 'server') {
- /** @var ISettings $form */
- $form = $this->container->query(\OCA\Settings\Admin\Server::class);
- if ($filter === null || $filter($form)) {
- $forms[$form->getPriority()] = [$form];
- }
- $form = $this->container->query(\OCA\Settings\Admin\Mail::class);
- if ($filter === null || $filter($form)) {
- $forms[$form->getPriority()] = [$form];
- }
- }
- if ($section === 'security') {
- /** @var ISettings $form */
- $form = $this->container->query(\OCA\Settings\Admin\Security::class);
- if ($filter === null || $filter($form)) {
- $forms[$form->getPriority()] = [$form];
- }
- }
- if ($section === 'sharing') {
- /** @var ISettings $form */
- $form = $this->container->query(\OCA\Settings\Admin\Sharing::class);
- if ($filter === null || $filter($form)) {
- $forms[$form->getPriority()] = [$form];
- }
- }
-
- return $forms;
- }
-
/**
* @inheritdoc
*/
$subAdminSettingsFilter = function(ISettings $settings) {
return $settings instanceof ISubAdminSettings;
};
- $settings = $this->getBuiltInAdminSettings($section, $subAdminSettingsFilter);
$appSettings = $this->getSettings('admin', $section, $subAdminSettingsFilter);
} else {
- $settings = $this->getBuiltInAdminSettings($section);
$appSettings = $this->getSettings('admin', $section);
}
+ $settings = [];
foreach ($appSettings as $setting) {
if (!isset($settings[$setting->getPriority()])) {
$settings[$setting->getPriority()] = [];
}
public function testGetAdminSettings() {
- $section = $this->createMock(Sharing::class);
- $section->expects($this->once())
- ->method('getPriority')
+ $section = $this->createMock(ISettings::class);
+ $section->method('getPriority')
->willReturn(13);
- $this->container->expects($this->once())
- ->method('query')
- ->with(Sharing::class)
+ $section->method('getSection')
+ ->willReturn('sharing');
+ $this->container->method('query')
+ ->with('myAdminClass')
->willReturn($section);
+ $this->manager->registerSetting('admin', 'myAdminClass');
$settings = $this->manager->getAdminSettings('sharing');
$this->assertEquals([
}
public function testGetAdminSettingsAsSubAdmin() {
- $section = $this->createMock(Sharing::class);
- $this->container->expects($this->once())
- ->method('query')
- ->with(Sharing::class)
+ $section = $this->createMock(ISettings::class);
+ $section->method('getPriority')
+ ->willReturn(13);
+ $section->method('getSection')
+ ->willReturn('sharing');
+ $this->container->method('query')
+ ->with('myAdminClass')
->willReturn($section);
+ $this->manager->registerSetting('admin', 'myAdminClass');
$settings = $this->manager->getAdminSettings('sharing', true);
$this->assertEquals([], $settings);
public function testGetSubAdminSettingsAsSubAdmin() {
$section = $this->createMock(ISubAdminSettings::class);
- $section->expects($this->once())
- ->method('getPriority')
+ $section->method('getPriority')
->willReturn(13);
+ $section->method('getSection')
+ ->willReturn('sharing');
$this->container->expects($this->once())
->method('query')
- ->with(Sharing::class)
+ ->with('mySubAdminClass')
->willReturn($section);
+ $this->manager->registerSetting('admin', 'mySubAdminClass');
$settings = $this->manager->getAdminSettings('sharing', true);
$this->assertEquals([