Skip to content

Commit

Permalink
Merge pull request #4277 from nextcloud/permissions-mask-scanner
Browse files Browse the repository at this point in the history
Dont use the permissions mask while scanning
  • Loading branch information
schiessle authored Apr 10, 2017
2 parents e9c6fe2 + a7c6110 commit 1858039
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/private/Files/Storage/Wrapper/PermissionsMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,8 @@ public function getMetaData($path) {
}
return $data;
}

public function getScanner($path = '', $storage = null) {
return parent::getScanner($path, $this->storage);
}
}
12 changes: 12 additions & 0 deletions tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

use OCP\Constants;

/**
* @group DB
*/
class PermissionsMaskTest extends \Test\Files\Storage\Storage {

/**
Expand Down Expand Up @@ -102,4 +105,13 @@ public function testFopenNewFileNoCreate() {
$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());
}
}

0 comments on commit 1858039

Please sign in to comment.