Fix readonly shares were mounted as writable when shared to another user

This commit is contained in:
nathangray 2021-02-16 16:14:32 -07:00
parent e54aebebca
commit c319478816
3 changed files with 14 additions and 3 deletions

View File

@ -259,7 +259,7 @@ class Base
'host' => $GLOBALS['egw_info']['user']['domain'],
'home' => str_replace(array('\\\\','\\'),array('','/'),$GLOBALS['egw_info']['user']['homedirectory']),
);
$parts = array_merge(Vfs::parse_url($path),$defaults);
$parts = array_merge(Vfs::parse_url($_path),Vfs::parse_url($path),$defaults);
if (!$parts['host']) $parts['host'] = 'default'; // otherwise we get an invalid url (scheme:///path/to/something)!
if (!empty($parts['scheme']) && $parts['scheme'] != self::SCHEME)

View File

@ -32,6 +32,16 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase
{
parent::tearDown();
}
/**
* Check that a user with permission to a file can access the file
*
* @depends testSimpleReadWrite
* @throws Api\Exception\AssertionFailed
*/
public function testWithAccess() : void
{
$this->markTestSkipped("Filesystem StreamWrapper does not support giving access to a file by changing group permissions");
}
protected function mount(): void
{

View File

@ -287,7 +287,8 @@ abstract class StreamWrapperBase extends LoggedInTest
"Could not write file $file"
);
$pre = Vfs::stat($this->test_file);
// Check that it's actually there
$this->assertEquals($contents,file_get_contents(Vfs::PREFIX . $file), "Did not write test file");
// Create another user who has no access to our file
$user_b = $this->makeUser();
@ -307,7 +308,7 @@ abstract class StreamWrapperBase extends LoggedInTest
// Check the file
$post = Vfs::stat($file);
$this->assertNotNull($post,
$this->assertIsArray($post,
"File '$file' was not accessible by another user who had permission"
);
$this->assertEquals(