diff --git a/api/src/Vfs/UserContextTrait.php b/api/src/Vfs/UserContextTrait.php index 1df3dd48da..e1ec74bc0e 100644 --- a/api/src/Vfs/UserContextTrait.php +++ b/api/src/Vfs/UserContextTrait.php @@ -59,6 +59,12 @@ trait UserContextTrait $this->check_set_context($url_or_context); } } + + // if we have no user set, set the current one / Api\Vfs::$user + if (empty(stream_context_get_options($this->context)[Vfs::SCHEME]['user']) && !empty(Api\Vfs::$user)) + { + stream_context_set_option($this->context, [Vfs::SCHEME => ['user' => Api\Vfs::$user]]); + } } /** @@ -248,4 +254,4 @@ trait UserContextTrait { return $this->__get($name) !== null; } -} +} \ No newline at end of file