2020-04-14 08:42:28 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2020-08-24 08:54:25 -04:00
|
|
|
|
2020-04-14 08:42:28 -04:00
|
|
|
/**
|
2024-05-27 11:39:07 -04:00
|
|
|
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2020-04-14 08:42:28 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCA\DAV\Storage;
|
|
|
|
|
|
|
|
|
|
use OC\Files\Storage\Wrapper\Wrapper;
|
|
|
|
|
|
|
|
|
|
class PublicOwnerWrapper extends Wrapper {
|
|
|
|
|
|
2024-09-16 10:00:46 -04:00
|
|
|
private string $owner;
|
2020-04-14 08:42:28 -04:00
|
|
|
|
|
|
|
|
/**
|
2024-10-08 09:13:16 -04:00
|
|
|
* @param array $parameters ['storage' => $storage, 'owner' => $owner]
|
2020-04-14 08:42:28 -04:00
|
|
|
*
|
|
|
|
|
* $storage: The storage the permissions mask should be applied on
|
|
|
|
|
* $owner: The owner to use in case no owner is found
|
|
|
|
|
*/
|
2024-10-08 09:13:16 -04:00
|
|
|
public function __construct(array $parameters) {
|
|
|
|
|
parent::__construct($parameters);
|
|
|
|
|
$this->owner = $parameters['owner'];
|
2020-04-14 08:42:28 -04:00
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:14:48 -04:00
|
|
|
public function getOwner(string $path): string|false {
|
2020-04-14 08:42:28 -04:00
|
|
|
$owner = parent::getOwner($path);
|
2024-09-16 10:00:46 -04:00
|
|
|
if ($owner !== false) {
|
|
|
|
|
return $owner;
|
2020-04-14 08:42:28 -04:00
|
|
|
}
|
2020-05-01 04:50:26 -04:00
|
|
|
|
2024-09-16 10:00:46 -04:00
|
|
|
return $this->owner;
|
2020-04-14 08:42:28 -04:00
|
|
|
}
|
|
|
|
|
}
|