use unmasked permissions in shared scanner
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
4456fa57e0
commit
5d0897b8d7
3 changed files with 37 additions and 3 deletions
|
@ -31,6 +31,11 @@ use OC\Files\ObjectStore\NoopScanner;
|
||||||
* Scanner for SharedStorage
|
* Scanner for SharedStorage
|
||||||
*/
|
*/
|
||||||
class Scanner extends \OC\Files\Cache\Scanner {
|
class Scanner extends \OC\Files\Cache\Scanner {
|
||||||
|
/**
|
||||||
|
* @var \OCA\Files_Sharing\SharedStorage $storage
|
||||||
|
*/
|
||||||
|
protected $storage;
|
||||||
|
|
||||||
private $sourceScanner;
|
private $sourceScanner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,8 +51,8 @@ class Scanner extends \OC\Files\Cache\Scanner {
|
||||||
if ($data === null) {
|
if ($data === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
list($sourceStorage, $internalPath) = $this->storage->resolvePath($path);
|
$internalPath = $this->storage->getSourcePath($path);
|
||||||
$data['permissions'] = $sourceStorage->getPermissions($internalPath);
|
$data['permissions'] = $this->storage->getSourceStorage()->getPermissions($internalPath);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -446,7 +446,8 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSourceStorage() {
|
public function getSourceStorage() {
|
||||||
return $this->getWrapperStorage();
|
$this->init();
|
||||||
|
return $this->nonMaskedStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWrapperStorage() {
|
public function getWrapperStorage() {
|
||||||
|
|
|
@ -531,4 +531,32 @@ class SharedStorageTest extends TestCase {
|
||||||
$this->shareManager->deleteShare($share1);
|
$this->shareManager->deleteShare($share1);
|
||||||
$this->shareManager->deleteShare($share2);
|
$this->shareManager->deleteShare($share2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testOwnerPermissions() {
|
||||||
|
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
|
||||||
|
|
||||||
|
$share = $this->share(
|
||||||
|
\OCP\Share::SHARE_TYPE_USER,
|
||||||
|
$this->folder,
|
||||||
|
self::TEST_FILES_SHARING_API_USER1,
|
||||||
|
self::TEST_FILES_SHARING_API_USER2,
|
||||||
|
\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_DELETE
|
||||||
|
);
|
||||||
|
|
||||||
|
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
|
||||||
|
$view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
|
||||||
|
$this->assertTrue($view->file_exists($this->folder));
|
||||||
|
|
||||||
|
$view->file_put_contents($this->folder . '/newfile.txt', 'asd');
|
||||||
|
|
||||||
|
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
|
||||||
|
|
||||||
|
$this->assertTrue($this->view->file_exists($this->folder . '/newfile.txt'));
|
||||||
|
$this->assertEquals(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE,
|
||||||
|
$this->view->getFileInfo($this->folder . '/newfile.txt')->getPermissions());
|
||||||
|
|
||||||
|
$this->view->unlink($this->folder);
|
||||||
|
$this->shareManager->deleteShare($share);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue