summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/publicwebdav.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-06-12 17:53:56 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-06-14 10:14:08 +0200
commite7b58ed2bdfe4bb56866e76b8fdd618946fa3c51 (patch)
treee2c42d3c7c5f08a4094aa61408d5dcf274d881f7 /apps/files_sharing/publicwebdav.php
parent87e311b99628858ddb974cd35ae381a26b4bcdb5 (diff)
downloadnextcloud-server-e7b58ed2bdfe4bb56866e76b8fdd618946fa3c51.tar.gz
nextcloud-server-e7b58ed2bdfe4bb56866e76b8fdd618946fa3c51.zip
Properly expose read only public shares as read only
Diffstat (limited to 'apps/files_sharing/publicwebdav.php')
-rw-r--r--apps/files_sharing/publicwebdav.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/files_sharing/publicwebdav.php b/apps/files_sharing/publicwebdav.php
index b4f56eed89c..f33b920bc54 100644
--- a/apps/files_sharing/publicwebdav.php
+++ b/apps/files_sharing/publicwebdav.php
@@ -37,7 +37,15 @@ $server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav'));
$server->subscribeEvent('beforeMethod', function () use ($server, $objectTree, $authBackend) {
$share = $authBackend->getShare();
$owner = $share['uid_owner'];
+ $isWritable = $share['permissions'];
$fileId = $share['file_source'];
+
+ if (!$isWritable) {
+ \OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) {
+ return new \OCA\Files_Sharing\ReadOnlyWrapper(array('storage' => $storage));
+ });
+ }
+
OC_Util::setupFS($owner);
$ownerView = \OC\Files\Filesystem::getView();
$path = $ownerView->getPath($fileId);