use OCP\Files\StorageNotAvailableException;
use OCP\ICacheFactory;
use OCP\IUserManager;
+use OCP\Share\IShare;
/**
* Metadata cache for shared files
private ?string $ownerDisplayName = null;
private $numericId;
private DisplayNameCache $displayNameCache;
+ private IShare $share;
/**
* @param SharedStorage $storage
*/
- public function __construct($storage, ICacheEntry $sourceRootInfo, DisplayNameCache $displayNameCache) {
+ public function __construct(
+ $storage,
+ ICacheEntry $sourceRootInfo,
+ DisplayNameCache $displayNameCache,
+ IShare $share
+ ) {
$this->storage = $storage;
$this->sourceRootInfo = $sourceRootInfo;
$this->numericId = $sourceRootInfo->getStorageId();
$this->displayNameCache = $displayNameCache;
+ $this->share = $share;
parent::__construct(
null,
try {
if (isset($entry['permissions'])) {
- $entry['permissions'] &= $this->storage->getShare()->getPermissions();
+ $entry['permissions'] &= $this->share->getPermissions();
} else {
$entry['permissions'] = $this->storage->getPermissions($entry['path']);
}
// (IDE may say the exception is never thrown – false negative)
$sharePermissions = 0;
}
- $entry['uid_owner'] = $this->storage->getOwner('');
+ $entry['uid_owner'] = $this->share->getShareOwner();
$entry['displayname_owner'] = $this->getOwnerDisplayName();
if ($path === '') {
$entry['is_share_mount_point'] = true;
private function getOwnerDisplayName() {
if (!$this->ownerDisplayName) {
- $uid = $this->storage->getOwner('');
+ $uid = $this->share->getShareOwner();
$this->ownerDisplayName = $this->displayNameCache->getDisplayName($uid) ?? $uid;
}
return $this->ownerDisplayName;