]> source.dussan.org Git - nextcloud-server.git/commitdiff
Dont use the permissions mask while scanning 4278/head
authorRobin Appelman <robin@icewind.nl>
Mon, 10 Apr 2017 13:19:21 +0000 (15:19 +0200)
committerRobin Appelman <robin@icewind.nl>
Mon, 10 Apr 2017 14:35:46 +0000 (16:35 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/Storage/Wrapper/PermissionsMask.php
tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php

index 239824b67e2be8d49e1890b5124c5c5472905c61..86e3c8595f5259f61d0aa6ce578f2d67cd94d311 100644 (file)
@@ -138,4 +138,8 @@ class PermissionsMask extends Wrapper {
                $sourceCache = parent::getCache($path, $storage);
                return new CachePermissionsMask($sourceCache, $this->mask);
        }
+
+       public function getScanner($path = '', $storage = null) {
+               return parent::getScanner($path, $this->storage);
+       }
 }
index 9859915e2cb4c3740d7952347c267e810f0fee85..d0903ce5f97399725d36979747c1a427b0e4dcf5 100644 (file)
@@ -10,6 +10,9 @@ namespace Test\Files\Storage\Wrapper;
 
 use OCP\Constants;
 
+/**
+ * @group DB
+ */
 class PermissionsMaskTest extends \Test\Files\Storage\Storage {
 
        /**
@@ -102,4 +105,13 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage {
                $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE);
                $this->assertFalse($storage->fopen('foo', 'w'));
        }
+
+       public function testScanNewFiles() {
+               $storage = $this->getMaskedStorage(Constants::PERMISSION_READ + Constants::PERMISSION_CREATE);
+               $storage->file_put_contents('foo', 'bar');
+               $storage->getScanner()->scan('');
+
+               $this->assertEquals(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE, $this->sourceStorage->getCache()->get('foo')->getPermissions());
+               $this->assertEquals(Constants::PERMISSION_READ, $storage->getCache()->get('foo')->getPermissions());
+       }
 }