diff options
Diffstat (limited to 'apps/provisioning_api/lib/Controller/PreferencesController.php')
-rw-r--r-- | apps/provisioning_api/lib/Controller/PreferencesController.php | 55 |
1 files changed, 16 insertions, 39 deletions
diff --git a/apps/provisioning_api/lib/Controller/PreferencesController.php b/apps/provisioning_api/lib/Controller/PreferencesController.php index cc7a9efd764..8ae64e65b81 100644 --- a/apps/provisioning_api/lib/Controller/PreferencesController.php +++ b/apps/provisioning_api/lib/Controller/PreferencesController.php @@ -3,31 +3,14 @@ declare(strict_types=1); /** - * @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com> - * - * @author Joas Schilling <coding@schilljs.com> - * @author Kate Döen <kate.doeen@nextcloud.com> - * - * @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: 2022 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCA\Provisioning_API\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCSController; use OCP\Config\BeforePreferenceDeletedEvent; @@ -39,25 +22,17 @@ use OCP\IUserSession; class PreferencesController extends OCSController { - private IConfig $config; - private IUserSession $userSession; - private IEventDispatcher $eventDispatcher; - public function __construct( string $appName, IRequest $request, - IConfig $config, - IUserSession $userSession, - IEventDispatcher $eventDispatcher + private IConfig $config, + private IUserSession $userSession, + private IEventDispatcher $eventDispatcher, ) { parent::__construct($appName, $request); - $this->config = $config; - $this->userSession = $userSession; - $this->eventDispatcher = $eventDispatcher; } /** - * @NoAdminRequired * @NoSubAdminRequired * * Update multiple preference values of an app @@ -65,11 +40,12 @@ class PreferencesController extends OCSController { * @param string $appId ID of the app * @param array<string, string> $configs Key-value pairs of the preferences * - * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, list<empty>, array{}> * * 200: Preferences updated successfully * 400: Preference invalid */ + #[NoAdminRequired] public function setMultiplePreferences(string $appId, array $configs): DataResponse { $userId = $this->userSession->getUser()->getUID(); @@ -102,7 +78,6 @@ class PreferencesController extends OCSController { } /** - * @NoAdminRequired * @NoSubAdminRequired * * Update a preference value of an app @@ -110,11 +85,12 @@ class PreferencesController extends OCSController { * @param string $appId ID of the app * @param string $configKey Key of the preference * @param string $configValue New value - * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, list<empty>, array{}> * * 200: Preference updated successfully * 400: Preference invalid */ + #[NoAdminRequired] public function setPreference(string $appId, string $configKey, string $configValue): DataResponse { $userId = $this->userSession->getUser()->getUID(); @@ -143,18 +119,19 @@ class PreferencesController extends OCSController { } /** - * @NoAdminRequired * @NoSubAdminRequired * * Delete multiple preferences for an app * * @param string $appId ID of the app - * @param string[] $configKeys Keys to delete + * @param list<string> $configKeys Keys to delete + * + * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, list<empty>, array{}> * - * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, array<empty>, array{}> * 200: Preferences deleted successfully * 400: Preference invalid */ + #[NoAdminRequired] public function deleteMultiplePreference(string $appId, array $configKeys): DataResponse { $userId = $this->userSession->getUser()->getUID(); @@ -185,18 +162,18 @@ class PreferencesController extends OCSController { } /** - * @NoAdminRequired * @NoSubAdminRequired * * Delete a preference for an app * * @param string $appId ID of the app * @param string $configKey Key to delete - * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, list<empty>, array{}> * * 200: Preference deleted successfully * 400: Preference invalid */ + #[NoAdminRequired] public function deletePreference(string $appId, string $configKey): DataResponse { $userId = $this->userSession->getUser()->getUID(); |