Capabilities.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christopher Schäpers <kondou@ts.unde.re>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Julius Härtl <jus@bitgrid.net>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. * @author Tom Needham <tom@owncloud.com>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  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, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCA\Files;
  27. use OCA\Files\Service\DirectEditingService;
  28. use OCP\Capabilities\ICapability;
  29. use OCP\IConfig;
  30. use OCP\IURLGenerator;
  31. /**
  32. * Class Capabilities
  33. *
  34. * @package OCA\Files
  35. */
  36. class Capabilities implements ICapability {
  37. /** @var IConfig */
  38. protected $config;
  39. /** @var DirectEditingService */
  40. protected $directEditingService;
  41. /** @var IURLGenerator */
  42. private $urlGenerator;
  43. /**
  44. * Capabilities constructor.
  45. *
  46. * @param IConfig $config
  47. */
  48. public function __construct(IConfig $config, DirectEditingService $directEditingService, IURLGenerator $urlGenerator) {
  49. $this->config = $config;
  50. $this->directEditingService = $directEditingService;
  51. $this->urlGenerator = $urlGenerator;
  52. }
  53. /**
  54. * Return this classes capabilities
  55. *
  56. * @return array
  57. */
  58. public function getCapabilities() {
  59. return [
  60. 'files' => [
  61. 'bigfilechunking' => true,
  62. 'blacklisted_files' => $this->config->getSystemValue('blacklisted_files', ['.htaccess']),
  63. 'directEditing' => [
  64. 'url' => $this->urlGenerator->linkToOCSRouteAbsolute('files.DirectEditing.info'),
  65. 'etag' => $this->directEditingService->getDirectEditingETag()
  66. ]
  67. ],
  68. ];
  69. }
  70. }