Capabilities.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2017 Bjoern Schiessle <bjoern@schiessle.org>
  5. *
  6. * @author Bjoern Schiessle <bjoern@schiessle.org>
  7. * @author John Molakvoæ <skjnldsv@protonmail.com>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCA\ShareByMail;
  27. use OCA\ShareByMail\Settings\SettingsManager;
  28. use OCP\Capabilities\ICapability;
  29. use OCP\Share\IManager;
  30. class Capabilities implements ICapability {
  31. /** @var IManager */
  32. private $manager;
  33. /** @var SettingsManager */
  34. private $settingsManager;
  35. public function __construct(IManager $manager,
  36. SettingsManager $settingsManager) {
  37. $this->manager = $manager;
  38. $this->settingsManager = $settingsManager;
  39. }
  40. public function getCapabilities(): array {
  41. return [
  42. 'files_sharing' =>
  43. [
  44. 'sharebymail' =>
  45. [
  46. 'enabled' => $this->manager->shareApiAllowLinks(),
  47. 'send_password_by_mail' => $this->settingsManager->sendPasswordByMail(),
  48. 'upload_files_drop' => [
  49. 'enabled' => true,
  50. ],
  51. 'password' => [
  52. 'enabled' => true,
  53. 'enforced' => $this->manager->shareApiLinkEnforcePassword(),
  54. ],
  55. 'expire_date' => [
  56. 'enabled' => true,
  57. 'enforced' => $this->manager->shareApiLinkDefaultExpireDateEnforced(),
  58. ],
  59. ]
  60. ]
  61. ];
  62. }
  63. }