$sourceCache = parent::getCache($path, $storage);
return new CachePermissionsMask($sourceCache, $this->mask);
}
+
+ public function getScanner($path = '', $storage = null) {
+ return parent::getScanner($path, $this->storage);
+ }
}
use OCP\Constants;
+/**
+ * @group DB
+ */
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());
+ }
}