1
0

CachePermissionsMask.php 694 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OC\Files\Cache\Wrapper;
  8. class CachePermissionsMask extends CacheWrapper {
  9. /**
  10. * @var int
  11. */
  12. protected $mask;
  13. /**
  14. * @param \OCP\Files\Cache\ICache $cache
  15. * @param int $mask
  16. */
  17. public function __construct($cache, $mask) {
  18. parent::__construct($cache);
  19. $this->mask = $mask;
  20. }
  21. protected function formatCacheEntry($entry) {
  22. if (isset($entry['permissions'])) {
  23. $entry['scan_permissions'] = $entry['permissions'];
  24. $entry['permissions'] &= $this->mask;
  25. }
  26. return $entry;
  27. }
  28. }