]> source.dussan.org Git - nextcloud-server.git/commitdiff
Wrap publicwebdav in sharePermission mask
authorRoeland Jago Douma <roeland@famdouma.nl>
Mon, 6 Jun 2016 12:39:02 +0000 (14:39 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Mon, 6 Jun 2016 12:39:02 +0000 (14:39 +0200)
Fixes #24868

The writable mask was a bit misleading. We should wrap with the
sharepermissions (as they are used everywhere else). The
PERMISSIONS_SHARE are added since that is required for the public link
check plugin.

apps/dav/appinfo/v1/publicwebdav.php

index c6aaab2712f596d9a836dbc8c4ee0a9b310155e4..07004f43bd7f626ade5a67e506da79669a6a2ab2 100644 (file)
@@ -66,14 +66,11 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authBackend, func
 
        $share = $authBackend->getShare();
        $owner = $share->getShareOwner();
-       $isWritable = $share->getPermissions() & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE);
        $fileId = $share->getNodeId();
 
-       if (!$isWritable) {
-               \OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) {
-                       return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_SHARE));
-               });
-       }
+       \OC\Files\Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) {
+               return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE));
+       });
 
        OC_Util::setupFS($owner);
        $ownerView = \OC\Files\Filesystem::getView();