summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/readonlywrapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib/readonlywrapper.php')
-rw-r--r--apps/files_sharing/lib/readonlywrapper.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/readonlywrapper.php b/apps/files_sharing/lib/readonlywrapper.php
new file mode 100644
index 00000000000..45ed3fd68bb
--- /dev/null
+++ b/apps/files_sharing/lib/readonlywrapper.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCA\Files_Sharing;
+
+use OC\Files\Storage\Wrapper\Wrapper;
+
+class ReadOnlyWrapper extends Wrapper {
+ public function isUpdatable($path) {
+ return false;
+ }
+
+ public function isCreatable($path) {
+ return false;
+ }
+
+ public function isDeletable($path) {
+ return false;
+ }
+
+ public function getPermissions($path) {
+ return $this->storage->getPermissions($path) & (\OCP\PERMISSION_READ | \OCP\PERMISSION_SHARE);
+ }
+
+ public function rename($path1, $path2) {
+ return false;
+ }
+
+ public function touch($path, $mtime = null) {
+ return false;
+ }
+
+ public function mkdir($path) {
+ return false;
+ }
+
+ public function rmdir($path) {
+ return false;
+ }
+
+ public function unlink($path) {
+ return false;
+ }
+
+ public function getCache($path = '', $storage = null) {
+ if (!$storage) {
+ $storage = $this;
+ }
+ return new ReadOnlyCache($storage);
+ }
+}