2014-11-10 10:00:25 -05:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2014-11-10 10:00:25 -05:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2014-11-10 10:00:25 -05:00
|
|
|
*/
|
|
|
|
|
namespace OC\Files\Cache\Wrapper;
|
|
|
|
|
|
|
|
|
|
class CachePermissionsMask extends CacheWrapper {
|
|
|
|
|
/**
|
|
|
|
|
* @var int
|
|
|
|
|
*/
|
|
|
|
|
protected $mask;
|
|
|
|
|
|
|
|
|
|
/**
|
2016-01-22 07:01:37 -05:00
|
|
|
* @param \OCP\Files\Cache\ICache $cache
|
2014-11-10 10:00:25 -05:00
|
|
|
* @param int $mask
|
|
|
|
|
*/
|
|
|
|
|
public function __construct($cache, $mask) {
|
|
|
|
|
parent::__construct($cache);
|
|
|
|
|
$this->mask = $mask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function formatCacheEntry($entry) {
|
|
|
|
|
if (isset($entry['permissions'])) {
|
2025-09-28 08:03:53 -04:00
|
|
|
$entry['scan_permissions'] ??= $entry['permissions'];
|
2014-11-10 10:00:25 -05:00
|
|
|
$entry['permissions'] &= $this->mask;
|
|
|
|
|
}
|
|
|
|
|
return $entry;
|
|
|
|
|
}
|
|
|
|
|
}
|