diff options
author | Robin Appelman <robin@icewind.nl> | 2017-07-13 14:17:52 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2017-07-13 14:37:09 +0200 |
commit | 5804dfc0786ef602e6caa5ef848fa64075f71d76 (patch) | |
tree | ee8dc9a761a541cb8e20d3a4c92cf127cce85bd9 /tests | |
parent | 701a865db7293cb08227511ee92ae9d60a23b589 (diff) | |
download | nextcloud-server-5804dfc0786ef602e6caa5ef848fa64075f71d76.tar.gz nextcloud-server-5804dfc0786ef602e6caa5ef848fa64075f71d76.zip |
Fix scan permissions with nested permissions masks
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php index 354db9d069d..388272b4107 100644 --- a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php +++ b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php @@ -127,6 +127,21 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { $this->assertEquals(Constants::PERMISSION_READ, $storage->getCache()->get('foo')->getPermissions()); } + public function testScanNewFilesNested() { + $storage = $this->getMaskedStorage(Constants::PERMISSION_READ + Constants::PERMISSION_CREATE + Constants::PERMISSION_UPDATE); + $nestedStorage = new \OC\Files\Storage\Wrapper\PermissionsMask(array( + 'storage' => $storage, + 'mask' => Constants::PERMISSION_READ + Constants::PERMISSION_CREATE + )); + $wrappedStorage = new Wrapper(['storage' => $nestedStorage]); + $wrappedStorage->file_put_contents('foo', 'bar'); + $wrappedStorage->getScanner()->scan(''); + + $this->assertEquals(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE, $this->sourceStorage->getCache()->get('foo')->getPermissions()); + $this->assertEquals(Constants::PERMISSION_READ + Constants::PERMISSION_UPDATE, $storage->getCache()->get('foo')->getPermissions()); + $this->assertEquals(Constants::PERMISSION_READ, $wrappedStorage->getCache()->get('foo')->getPermissions()); + } + public function testScanUnchanged() { $this->sourceStorage->mkdir('foo'); $this->sourceStorage->file_put_contents('foo/bar.txt', 'bar'); |