aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2017-04-10 16:04:12 +0200
committerGitHub <noreply@github.com>2017-04-10 16:04:12 +0200
commit18580395d4095842462e035a2d947e716413d2fd (patch)
tree92ff5332454651ce54c02d3075c5942e4d4e4459
parente9c6fe2fd868d7254603a6fb23451392f2af8b54 (diff)
parenta7c611039d4ff2008441d0cc79eefcd61fccac48 (diff)
downloadnextcloud-server-18580395d4095842462e035a2d947e716413d2fd.tar.gz
nextcloud-server-18580395d4095842462e035a2d947e716413d2fd.zip
Merge pull request #4277 from nextcloud/permissions-mask-scanner
Dont use the permissions mask while scanning
-rw-r--r--lib/private/Files/Storage/Wrapper/PermissionsMask.php4
-rw-r--r--tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php12
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/private/Files/Storage/Wrapper/PermissionsMask.php b/lib/private/Files/Storage/Wrapper/PermissionsMask.php
index ab0c30a4736..d66390dad49 100644
--- a/lib/private/Files/Storage/Wrapper/PermissionsMask.php
+++ b/lib/private/Files/Storage/Wrapper/PermissionsMask.php
@@ -147,4 +147,8 @@ class PermissionsMask extends Wrapper {
}
return $data;
}
+
+ public function getScanner($path = '', $storage = null) {
+ return parent::getScanner($path, $this->storage);
+ }
}
diff --git a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php
index 9859915e2cb..d0903ce5f97 100644
--- a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php
+++ b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php
@@ -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());
+ }
}