Dont use the permissions mask while scanning

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2017-04-10 15:19:21 +02:00
parent afea05d296
commit a7c611039d
No known key found for this signature in database
GPG Key ID: CBCA68FBAEBF98C9
2 changed files with 16 additions and 0 deletions

View File

@ -147,4 +147,8 @@ class PermissionsMask extends Wrapper {
}
return $data;
}
public function getScanner($path = '', $storage = null) {
return parent::getScanner($path, $this->storage);
}
}

View 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());
}
}