1
0

PublicOwnerWrapper.php 787 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\DAV\Storage;
  8. use OC\Files\Storage\Wrapper\Wrapper;
  9. class PublicOwnerWrapper extends Wrapper {
  10. private string $owner;
  11. /**
  12. * @param array $arguments ['storage' => $storage, 'owner' => $owner]
  13. *
  14. * $storage: The storage the permissions mask should be applied on
  15. * $owner: The owner to use in case no owner is found
  16. */
  17. public function __construct($arguments) {
  18. parent::__construct($arguments);
  19. $this->owner = $arguments['owner'];
  20. }
  21. public function getOwner($path): string|false {
  22. $owner = parent::getOwner($path);
  23. if ($owner !== false) {
  24. return $owner;
  25. }
  26. return $this->owner;
  27. }
  28. }