readonlycache.php 713 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace OCA\Files_Sharing;
  9. use OC\Files\Cache\Cache;
  10. class ReadOnlyCache extends Cache {
  11. public function get($path) {
  12. $data = parent::get($path);
  13. $data['permissions'] &= (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE);
  14. return $data;
  15. }
  16. public function getFolderContents($path) {
  17. $content = parent::getFolderContents($path);
  18. foreach ($content as &$data) {
  19. $data['permissions'] &= (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE);
  20. }
  21. return $content;
  22. }
  23. }