mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
4886583cc1
without the need to destroy the session, if the sharee is a different user This is accomplished by keeping the sharee in the stream context / attribute of the vfs class(es) instead of static Vfs::$user. Later is still used for the current user - identical to egw_info[user][account_id]. This commit / merge of the vfs-context feature branch also added the abilty to mount WebDAV sources, eg. a sharing link from an other EGroupware instance or any WebDAV server
60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Test the basic Vfs::StreamWrapper
|
|
*
|
|
* @link http://www.egroupware.org
|
|
* @author Nathan Gray
|
|
* @copyright (c) 2020 Nathan Gray
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
*/
|
|
|
|
namespace EGroupware\Api\Vfs;
|
|
|
|
require_once __DIR__ . '/StreamWrapperBase.php';
|
|
|
|
use EGroupware\Api;
|
|
use EGroupware\Api\LoggedInTest as LoggedInTest;
|
|
use EGroupware\Api\Vfs;
|
|
use EGroupware\Stylite\Vfs\Versioning;
|
|
|
|
|
|
class StreamWrapperTest extends StreamWrapperBase
|
|
{
|
|
protected function setUp() : void
|
|
{
|
|
parent::setUp();
|
|
$this->files[] = $this->test_file = $this->getFilename();
|
|
}
|
|
|
|
protected function tearDown() : void
|
|
{
|
|
// Do local stuff first, parent will remove stuff
|
|
|
|
parent::tearDown();
|
|
}
|
|
|
|
public function testWithAccess() : void
|
|
{
|
|
// Put it in the group directory this time so we can give access
|
|
$this->files[] = $this->test_file = $this->getFilename('/home/Default');
|
|
|
|
parent::testWithAccess();
|
|
}
|
|
|
|
protected function mount(): void
|
|
{
|
|
// Nothing here
|
|
}
|
|
|
|
protected function allowAccess(string $test_name, string &$test_file, int $test_user, string $needed) : void
|
|
{
|
|
// We'll allow access by putting test user in Default group
|
|
$command = new \admin_cmd_edit_user($test_user, ['account_groups' => array_merge($this->account['account_groups'],['Default'])]);
|
|
$command->run();
|
|
|
|
// Add explicit permission on group
|
|
Vfs::chmod($test_file, Vfs::mode2int('g+'.$needed));
|
|
|
|
}
|
|
} |