Admin.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\Federation\Settings;
  7. use OCA\Federation\TrustedServers;
  8. use OCP\AppFramework\Http\TemplateResponse;
  9. use OCP\IL10N;
  10. use OCP\Settings\IDelegatedSettings;
  11. class Admin implements IDelegatedSettings {
  12. private TrustedServers $trustedServers;
  13. private IL10N $l;
  14. public function __construct(TrustedServers $trustedServers, IL10N $l) {
  15. $this->trustedServers = $trustedServers;
  16. $this->l = $l;
  17. }
  18. /**
  19. * @return TemplateResponse
  20. */
  21. public function getForm() {
  22. $parameters = [
  23. 'trustedServers' => $this->trustedServers->getServers(),
  24. ];
  25. return new TemplateResponse('federation', 'settings-admin', $parameters, '');
  26. }
  27. /**
  28. * @return string the section ID, e.g. 'sharing'
  29. */
  30. public function getSection() {
  31. return 'sharing';
  32. }
  33. /**
  34. * @return int whether the form should be rather on the top or bottom of
  35. * the admin section. The forms are arranged in ascending order of the
  36. * priority values. It is required to return a value between 0 and 100.
  37. *
  38. * E.g.: 70
  39. */
  40. public function getPriority() {
  41. return 30;
  42. }
  43. public function getName(): ?string {
  44. return $this->l->t("Trusted servers");
  45. }
  46. public function getAuthorizedAppConfig(): array {
  47. return []; // Handled by custom controller
  48. }
  49. }