Admin.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\ShareByMail\Settings;
  7. use OCP\AppFramework\Http\TemplateResponse;
  8. use OCP\AppFramework\Services\IInitialState;
  9. use OCP\IL10N;
  10. use OCP\Settings\IDelegatedSettings;
  11. class Admin implements IDelegatedSettings {
  12. public function __construct(
  13. private SettingsManager $settingsManager,
  14. private IL10N $l,
  15. private IInitialState $initialState,
  16. ) {
  17. }
  18. /**
  19. * @return TemplateResponse
  20. */
  21. public function getForm() {
  22. $this->initialState->provideInitialState('sendPasswordMail', $this->settingsManager->sendPasswordByMail());
  23. $this->initialState->provideInitialState('replyToInitiator', $this->settingsManager->replyToInitiator());
  24. return new TemplateResponse('sharebymail', 'settings-admin', [], '');
  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 40;
  41. }
  42. public function getName(): ?string {
  43. return $this->l->t('Share by mail');
  44. }
  45. public function getAuthorizedAppConfig(): array {
  46. return [
  47. 'sharebymail' => ['s/(sendpasswordmail|replyToInitiator)/'],
  48. ];
  49. }
  50. }