ConfigController.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\Testing\Controller;
  8. use OCP\AppFramework\Http\DataResponse;
  9. use OCP\AppFramework\OCSController;
  10. use OCP\IConfig;
  11. use OCP\IRequest;
  12. class ConfigController extends OCSController {
  13. /**
  14. * @param string $appName
  15. * @param IRequest $request
  16. * @param IConfig $config
  17. */
  18. public function __construct(
  19. $appName,
  20. IRequest $request,
  21. private IConfig $config,
  22. ) {
  23. parent::__construct($appName, $request);
  24. }
  25. /**
  26. * @param string $appid
  27. * @param string $configkey
  28. * @param string $value
  29. * @return DataResponse
  30. */
  31. public function setAppValue($appid, $configkey, $value) {
  32. $this->config->setAppValue($appid, $configkey, $value);
  33. return new DataResponse();
  34. }
  35. /**
  36. * @param string $appid
  37. * @param string $configkey
  38. * @return DataResponse
  39. */
  40. public function deleteAppValue($appid, $configkey) {
  41. $this->config->deleteAppValue($appid, $configkey);
  42. return new DataResponse();
  43. }
  44. }