1
0

PublicOwnerWrapper.php 806 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. /** @var string */
  11. private $owner;
  12. /**
  13. * @param array $arguments ['storage' => $storage, 'owner' => $owner]
  14. *
  15. * $storage: The storage the permissions mask should be applied on
  16. * $owner: The owner to use in case no owner is found
  17. */
  18. public function __construct($arguments) {
  19. parent::__construct($arguments);
  20. $this->owner = $arguments['owner'];
  21. }
  22. public function getOwner($path) {
  23. $owner = parent::getOwner($path);
  24. if ($owner === null || $owner === false) {
  25. return $this->owner;
  26. }
  27. return $owner;
  28. }
  29. }