diff options
Diffstat (limited to 'lib/public/Settings')
-rw-r--r-- | lib/public/Settings/DeclarativeSettingsTypes.php | 6 | ||||
-rw-r--r-- | lib/public/Settings/Events/DeclarativeSettingsRegisterFormEvent.php | 4 | ||||
-rw-r--r-- | lib/public/Settings/IDeclarativeSettingsForm.php | 1 | ||||
-rw-r--r-- | lib/public/Settings/IDeclarativeSettingsFormWithHandlers.php | 31 | ||||
-rw-r--r-- | lib/public/Settings/IIconSection.php | 5 | ||||
-rw-r--r-- | lib/public/Settings/IManager.php | 3 | ||||
-rw-r--r-- | lib/public/Settings/ISettings.php | 5 |
7 files changed, 46 insertions, 9 deletions
diff --git a/lib/public/Settings/DeclarativeSettingsTypes.php b/lib/public/Settings/DeclarativeSettingsTypes.php index 82444af9b82..7edf0cbdd6e 100644 --- a/lib/public/Settings/DeclarativeSettingsTypes.php +++ b/lib/public/Settings/DeclarativeSettingsTypes.php @@ -32,8 +32,9 @@ final class DeclarativeSettingsTypes { /** * IDeclarativeSettingsForm storage_type which is determines where and how the config value is stored * - * - * For `external` storage_type the app implementing \OCP\Settings\SetDeclarativeSettingsValueEvent and \OCP\Settings\GetDeclarativeSettingsValueEvent events is responsible for storing and retrieving the config value. + * For `external` storage_type the app needs to either implement event listeners for \OCP\Settings\SetDeclarativeSettingsValueEvent + * and \OCP\Settings\GetDeclarativeSettingsValueEvent or the IDeclarativeSettingsForm also needs to implement + * IDeclarativeSettingsFormWithHandlers for storing and retrieving the config value. * * @since 29.0.0 */ @@ -43,7 +44,6 @@ final class DeclarativeSettingsTypes { * IDeclarativeSettingsForm storage_type which is determines where and how the config value is stored * * For `internal` storage_type the config value is stored in default `appconfig` and `preferences` tables. - * For `external` storage_type the app implementing \OCP\Settings\SetDeclarativeSettingsValueEvent and \OCP\Settings\GetDeclarativeSettingsValueEvent events is responsible for storing and retrieving the config value. * * @since 29.0.0 */ diff --git a/lib/public/Settings/Events/DeclarativeSettingsRegisterFormEvent.php b/lib/public/Settings/Events/DeclarativeSettingsRegisterFormEvent.php index 951e4ad9298..e861afdd580 100644 --- a/lib/public/Settings/Events/DeclarativeSettingsRegisterFormEvent.php +++ b/lib/public/Settings/Events/DeclarativeSettingsRegisterFormEvent.php @@ -22,7 +22,9 @@ class DeclarativeSettingsRegisterFormEvent extends Event { /** * @since 29.0.0 */ - public function __construct(private IDeclarativeManager $manager) { + public function __construct( + private IDeclarativeManager $manager, + ) { parent::__construct(); } diff --git a/lib/public/Settings/IDeclarativeSettingsForm.php b/lib/public/Settings/IDeclarativeSettingsForm.php index d471cdf4a93..419905b7b23 100644 --- a/lib/public/Settings/IDeclarativeSettingsForm.php +++ b/lib/public/Settings/IDeclarativeSettingsForm.php @@ -27,6 +27,7 @@ namespace OCP\Settings; * label?: string, * default: mixed, * options?: list<string|array{name: string, value: mixed}>, + * sensitive?: boolean, * } * * @psalm-type DeclarativeSettingsFormFieldWithValue = DeclarativeSettingsFormField&array{ diff --git a/lib/public/Settings/IDeclarativeSettingsFormWithHandlers.php b/lib/public/Settings/IDeclarativeSettingsFormWithHandlers.php new file mode 100644 index 00000000000..180df73d995 --- /dev/null +++ b/lib/public/Settings/IDeclarativeSettingsFormWithHandlers.php @@ -0,0 +1,31 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\Settings; + +use OCP\IUser; + +/** + * @since 31.0.0 + */ +interface IDeclarativeSettingsFormWithHandlers extends IDeclarativeSettingsForm { + + /** + * This function is called to get the current value of a specific forms field. + * @since 31.0.0 + */ + public function getValue(string $fieldId, IUser $user): mixed; + + /** + * This function is called when a user updated a form field to persist the setting. + * @since 31.0.0 + */ + public function setValue(string $fieldId, mixed $value, IUser $user): void; + +} diff --git a/lib/public/Settings/IIconSection.php b/lib/public/Settings/IIconSection.php index 5a9fbfebf76..4d0fe40aa29 100644 --- a/lib/public/Settings/IIconSection.php +++ b/lib/public/Settings/IIconSection.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -29,8 +30,8 @@ interface IIconSection { /** * @return int whether the form should be rather on the top or bottom of - * the settings navigation. The sections are arranged in ascending order of - * the priority values. It is required to return a value between 0 and 99. + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. * * E.g.: 70 * @since 9.1 diff --git a/lib/public/Settings/IManager.php b/lib/public/Settings/IManager.php index d73e4055f31..954fd3fdb56 100644 --- a/lib/public/Settings/IManager.php +++ b/lib/public/Settings/IManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -89,7 +90,7 @@ interface IManager { /** * Returns a list of admin settings that the given user can use for the give section * - * @return array<int, list<ISettings>> The array of admin settings there admin delegation is allowed. + * @return array<int, list<ISettings>> List of admin-settings the user has access to, with priority as key. * @since 23.0.0 */ public function getAllowedAdminSettings(string $section, IUser $user): array; diff --git a/lib/public/Settings/ISettings.php b/lib/public/Settings/ISettings.php index ed465a07fb3..e33556f0b4a 100644 --- a/lib/public/Settings/ISettings.php +++ b/lib/public/Settings/ISettings.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -25,8 +26,8 @@ interface ISettings { /** * @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. + * 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 |