Capabilities.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\Files;
  8. use OC\Files\FilenameValidator;
  9. use OCP\Capabilities\ICapability;
  10. class Capabilities implements ICapability {
  11. public function __construct(
  12. protected FilenameValidator $filenameValidator,
  13. ) {
  14. }
  15. /**
  16. * Return this classes capabilities
  17. *
  18. * @return array{files: array{'$comment': ?string, bigfilechunking: bool, blacklisted_files: array<mixed>, forbidden_filenames: list<string>, forbidden_filename_basenames: list<string>, forbidden_filename_characters: list<string>, forbidden_filename_extensions: list<string>}}
  19. */
  20. public function getCapabilities(): array {
  21. return [
  22. 'files' => [
  23. '$comment' => '"blacklisted_files" is deprecated as of Nextcloud 30, use "forbidden_filenames" instead',
  24. 'blacklisted_files' => $this->filenameValidator->getForbiddenFilenames(),
  25. 'forbidden_filenames' => $this->filenameValidator->getForbiddenFilenames(),
  26. 'forbidden_filename_basenames' => $this->filenameValidator->getForbiddenBasenames(),
  27. 'forbidden_filename_characters' => $this->filenameValidator->getForbiddenCharacters(),
  28. 'forbidden_filename_extensions' => $this->filenameValidator->getForbiddenExtensions(),
  29. 'bigfilechunking' => true,
  30. ],
  31. ];
  32. }
  33. }