Capabilities.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 OCP\Capabilities\ICapability;
  28. use OCP\Share\IManager;
  29. class Capabilities implements ICapability {
  30. /** @var IManager */
  31. private $manager;
  32. public function __construct(IManager $manager) {
  33. $this->manager = $manager;
  34. }
  35. public function getCapabilities(): array {
  36. return [
  37. 'files_sharing' =>
  38. [
  39. 'sharebymail' =>
  40. [
  41. 'enabled' => $this->manager->shareApiAllowLinks(),
  42. 'upload_files_drop' => [
  43. 'enabled' => true,
  44. ],
  45. 'password' => [
  46. 'enabled' => true,
  47. 'enforced' => $this->manager->shareApiLinkEnforcePassword(),
  48. ],
  49. 'expire_date' => [
  50. 'enabled' => true,
  51. 'enforced' => $this->manager->shareApiLinkDefaultExpireDateEnforced(),
  52. ],
  53. ]
  54. ]
  55. ];
  56. }
  57. }