diff options
Diffstat (limited to 'apps/settings/lib/Settings/Admin/Delegation.php')
-rw-r--r-- | apps/settings/lib/Settings/Admin/Delegation.php | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/apps/settings/lib/Settings/Admin/Delegation.php b/apps/settings/lib/Settings/Admin/Delegation.php index 401d5b028cc..59a26d1ac04 100644 --- a/apps/settings/lib/Settings/Admin/Delegation.php +++ b/apps/settings/lib/Settings/Admin/Delegation.php @@ -1,26 +1,9 @@ <?php + /** - * @copyright Copyright (c) 2021 Carl Schwan <carl@carlschwan.eu> - * - * @author Carl Schwan <carl@carlschwan.eu> - * - * @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 <https://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ - namespace OCA\Settings\Settings\Admin; use OCA\Settings\AppInfo\Application; @@ -28,33 +11,19 @@ use OCA\Settings\Service\AuthorizedGroupService; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; use OCP\IGroupManager; +use OCP\IURLGenerator; use OCP\Settings\IDelegatedSettings; use OCP\Settings\IManager; use OCP\Settings\ISettings; class Delegation implements ISettings { - /** @var IManager */ - private $settingManager; - - /** @var IInitialState $initialStateService */ - private $initialStateService; - - /** @var IGroupManager $groupManager */ - private $groupManager; - - /** @var AuthorizedGroupService $authorizedGroupService */ - private $authorizedGroupService; - public function __construct( - IManager $settingManager, - IInitialState $initialStateService, - IGroupManager $groupManager, - AuthorizedGroupService $authorizedGroupService + private IManager $settingManager, + private IInitialState $initialStateService, + private IGroupManager $groupManager, + private AuthorizedGroupService $authorizedGroupService, + private IURLGenerator $urlGenerator, ) { - $this->settingManager = $settingManager; - $this->initialStateService = $initialStateService; - $this->groupManager = $groupManager; - $this->authorizedGroupService = $authorizedGroupService; } /** @@ -85,9 +54,11 @@ class Delegation implements ISettings { $settings = array_merge( $settings, array_map(function (IDelegatedSettings $setting) use ($section) { + $sectionName = $section->getName() . ($setting->getName() !== null ? ' - ' . $setting->getName() : ''); return [ 'class' => get_class($setting), - 'sectionName' => $section->getName() . ($setting->getName() !== null ? ' - ' . $setting->getName() : ''), + 'sectionName' => $sectionName, + 'id' => mb_strtolower(str_replace(' ', '-', $sectionName)), 'priority' => $section->getPriority(), ]; }, $sectionSettings) @@ -128,6 +99,7 @@ class Delegation implements ISettings { $this->initSettingState(); $this->initAvailableGroupState(); $this->initAuthorizedGroupState(); + $this->initialStateService->provideInitialState('authorized-settings-doc-link', $this->urlGenerator->linkToDocs('admin-delegation')); return new TemplateResponse(Application::APP_ID, 'settings/admin/delegation', [], ''); } |