1
0

ConfigController.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. /** @var IConfig */
  14. private $config;
  15. /**
  16. * @param string $appName
  17. * @param IRequest $request
  18. * @param IConfig $config
  19. */
  20. public function __construct($appName,
  21. IRequest $request,
  22. IConfig $config) {
  23. parent::__construct($appName, $request);
  24. $this->config = $config;
  25. }
  26. /**
  27. * @param string $appid
  28. * @param string $configkey
  29. * @param string $value
  30. * @return DataResponse
  31. */
  32. public function setAppValue($appid, $configkey, $value) {
  33. $this->config->setAppValue($appid, $configkey, $value);
  34. return new DataResponse();
  35. }
  36. /**
  37. * @param string $appid
  38. * @param string $configkey
  39. * @return DataResponse
  40. */
  41. public function deleteAppValue($appid, $configkey) {
  42. $this->config->deleteAppValue($appid, $configkey);
  43. return new DataResponse();
  44. }
  45. }