f7cloud_client/apps/groupfolders/lib/Mount/CacheRootPermissionsMask.php
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

34 lines
785 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2022 F7cloud GmbH and F7cloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\GroupFolders\Mount;
use OC\Files\Cache\Wrapper\CacheWrapper;
use OCP\Files\Cache\ICache;
use OCP\Files\Cache\ICacheEntry;
class CacheRootPermissionsMask extends CacheWrapper {
public function __construct(
ICache $cache,
private readonly int $mask,
private readonly int $rootId,
) {
parent::__construct($cache);
}
protected function formatCacheEntry($entry): ICacheEntry|false {
$isRoot = $entry->getId() === $this->rootId;
if (isset($entry['permissions']) && $isRoot) {
$entry['scan_permissions'] ??= $entry['permissions'];
$entry['permissions'] &= $this->mask;
}
return $entry;
}
}