SettingsManager.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\ShareByMail\Settings;
  8. use OCP\IConfig;
  9. class SettingsManager {
  10. /** @var IConfig */
  11. private $config;
  12. private $sendPasswordByMailDefault = 'yes';
  13. private $replyToInitiatorDefault = 'yes';
  14. public function __construct(IConfig $config) {
  15. $this->config = $config;
  16. }
  17. /**
  18. * should the password for a mail share be send to the recipient
  19. *
  20. * @return bool
  21. */
  22. public function sendPasswordByMail(): bool {
  23. $sendPasswordByMail = $this->config->getAppValue('sharebymail', 'sendpasswordmail', $this->sendPasswordByMailDefault);
  24. return $sendPasswordByMail === 'yes';
  25. }
  26. /**
  27. * should add reply to with initiator mail
  28. *
  29. * @return bool
  30. */
  31. public function replyToInitiator(): bool {
  32. $replyToInitiator = $this->config->getAppValue('sharebymail', 'replyToInitiator', $this->replyToInitiatorDefault);
  33. return $replyToInitiator === 'yes';
  34. }
  35. }