Admin.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. public function __construct(
  13. private TrustedServers $trustedServers,
  14. private IL10N $l,
  15. ) {
  16. }
  17. /**
  18. * @return TemplateResponse
  19. */
  20. public function getForm() {
  21. $parameters = [
  22. 'trustedServers' => $this->trustedServers->getServers(),
  23. ];
  24. return new TemplateResponse('federation', 'settings-admin', $parameters, '');
  25. }
  26. /**
  27. * @return string the section ID, e.g. 'sharing'
  28. */
  29. public function getSection() {
  30. return 'sharing';
  31. }
  32. /**
  33. * @return int whether the form should be rather on the top or bottom of
  34. * the admin section. The forms are arranged in ascending order of the
  35. * priority values. It is required to return a value between 0 and 100.
  36. *
  37. * E.g.: 70
  38. */
  39. public function getPriority() {
  40. return 30;
  41. }
  42. public function getName(): ?string {
  43. return $this->l->t('Trusted servers');
  44. }
  45. public function getAuthorizedAppConfig(): array {
  46. return []; // Handled by custom controller
  47. }
  48. }