You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Capabilities.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright 2022 Carl Schwan <carl@carlschwan.eu>
  5. * @license AGPL-3.0-or-later
  6. *
  7. * This code is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Affero General Public License, version 3,
  9. * as published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License, version 3,
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>
  18. *
  19. */
  20. namespace OC\Metadata;
  21. use OCP\Capabilities\IPublicCapability;
  22. use OCP\IConfig;
  23. class Capabilities implements IPublicCapability {
  24. private IMetadataManager $manager;
  25. private IConfig $config;
  26. public function __construct(IMetadataManager $manager, IConfig $config) {
  27. $this->manager = $manager;
  28. $this->config = $config;
  29. }
  30. public function getCapabilities() {
  31. if ($this->config->getSystemValueBool('enable_file_metadata', true)) {
  32. return ['metadataAvailable' => $this->manager->getCapabilities()];
  33. }
  34. return [];
  35. }
  36. }