Capabilities.php 915 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 ownCloud GmbH
  4. * SPDX-License-Identifier: AGPL-3.0-only
  5. */
  6. namespace OCA\DAV;
  7. use OCP\Capabilities\ICapability;
  8. use OCP\IConfig;
  9. use OCP\User\IAvailabilityCoordinator;
  10. class Capabilities implements ICapability {
  11. public function __construct(
  12. private IConfig $config,
  13. private IAvailabilityCoordinator $coordinator,
  14. ) {
  15. }
  16. /**
  17. * @return array{dav: array{chunking: string, bulkupload?: string, absence-supported?: bool, absence-replacement?: bool}}
  18. */
  19. public function getCapabilities() {
  20. $capabilities = [
  21. 'dav' => [
  22. 'chunking' => '1.0',
  23. ]
  24. ];
  25. if ($this->config->getSystemValueBool('bulkupload.enabled', true)) {
  26. $capabilities['dav']['bulkupload'] = '1.0';
  27. }
  28. if ($this->coordinator->isEnabled()) {
  29. $capabilities['dav']['absence-supported'] = true;
  30. $capabilities['dav']['absence-replacement'] = true;
  31. }
  32. return $capabilities;
  33. }
  34. }