readonlywrapper.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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\Storage\Wrapper\Wrapper;
  10. class ReadOnlyWrapper extends Wrapper {
  11. public function isUpdatable($path) {
  12. return false;
  13. }
  14. public function isCreatable($path) {
  15. return false;
  16. }
  17. public function isDeletable($path) {
  18. return false;
  19. }
  20. public function getPermissions($path) {
  21. return $this->storage->getPermissions($path) & (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE);
  22. }
  23. public function rename($path1, $path2) {
  24. return false;
  25. }
  26. public function touch($path, $mtime = null) {
  27. return false;
  28. }
  29. public function mkdir($path) {
  30. return false;
  31. }
  32. public function rmdir($path) {
  33. return false;
  34. }
  35. public function unlink($path) {
  36. return false;
  37. }
  38. public function getCache($path = '', $storage = null) {
  39. if (!$storage) {
  40. $storage = $this;
  41. }
  42. return new ReadOnlyCache($storage);
  43. }
  44. }