backportbot[bot]
16 hours ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with
41 additions and
0 deletions
-
apps/dav/composer/composer/autoload_classmap.php
-
apps/dav/composer/composer/autoload_static.php
-
apps/dav/lib/Connector/Sabre/ServerFactory.php
-
apps/dav/lib/Connector/Sabre/UserIdHeaderPlugin.php
-
apps/dav/lib/Server.php
|
|
|
@ -252,6 +252,7 @@ return array( |
|
|
|
'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => $baseDir . '/../lib/Connector/Sabre/SharesPlugin.php', |
|
|
|
'OCA\\DAV\\Connector\\Sabre\\TagList' => $baseDir . '/../lib/Connector/Sabre/TagList.php', |
|
|
|
'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => $baseDir . '/../lib/Connector/Sabre/TagsPlugin.php', |
|
|
|
'OCA\\DAV\\Connector\\Sabre\\UserIdHeaderPlugin' => $baseDir . '/../lib/Connector/Sabre/UserIdHeaderPlugin.php', |
|
|
|
'OCA\\DAV\\Connector\\Sabre\\ZipFolderPlugin' => $baseDir . '/../lib/Connector/Sabre/ZipFolderPlugin.php', |
|
|
|
'OCA\\DAV\\Controller\\BirthdayCalendarController' => $baseDir . '/../lib/Controller/BirthdayCalendarController.php', |
|
|
|
'OCA\\DAV\\Controller\\DirectController' => $baseDir . '/../lib/Controller/DirectController.php', |
|
|
|
|
|
|
|
@ -267,6 +267,7 @@ class ComposerStaticInitDAV |
|
|
|
'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/SharesPlugin.php', |
|
|
|
'OCA\\DAV\\Connector\\Sabre\\TagList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/TagList.php', |
|
|
|
'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/TagsPlugin.php', |
|
|
|
'OCA\\DAV\\Connector\\Sabre\\UserIdHeaderPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/UserIdHeaderPlugin.php', |
|
|
|
'OCA\\DAV\\Connector\\Sabre\\ZipFolderPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ZipFolderPlugin.php', |
|
|
|
'OCA\\DAV\\Controller\\BirthdayCalendarController' => __DIR__ . '/..' . '/../lib/Controller/BirthdayCalendarController.php', |
|
|
|
'OCA\\DAV\\Controller\\DirectController' => __DIR__ . '/..' . '/../lib/Controller/DirectController.php', |
|
|
|
|
|
|
|
@ -103,6 +103,7 @@ class ServerFactory { |
|
|
|
$server->addPlugin(new LockPlugin()); |
|
|
|
|
|
|
|
$server->addPlugin(new RequestIdHeaderPlugin($this->request)); |
|
|
|
$server->addPlugin(new UserIdHeaderPlugin($this->userSession)); |
|
|
|
|
|
|
|
$server->addPlugin(new ZipFolderPlugin( |
|
|
|
$tree, |
|
|
|
|
|
|
|
@ -0,0 +1,36 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
declare(strict_types=1); |
|
|
|
/** |
|
|
|
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors |
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later |
|
|
|
*/ |
|
|
|
|
|
|
|
namespace OCA\DAV\Connector\Sabre; |
|
|
|
|
|
|
|
use OCP\IUserSession; |
|
|
|
use Sabre\HTTP\RequestInterface; |
|
|
|
use Sabre\HTTP\ResponseInterface; |
|
|
|
|
|
|
|
class UserIdHeaderPlugin extends \Sabre\DAV\ServerPlugin { |
|
|
|
public function __construct( |
|
|
|
private readonly IUserSession $userSession, |
|
|
|
) { |
|
|
|
} |
|
|
|
|
|
|
|
public function initialize(\Sabre\DAV\Server $server): void { |
|
|
|
$server->on('afterMethod:*', [$this, 'afterMethod']); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Add the request id as a header in the response |
|
|
|
* |
|
|
|
* @param RequestInterface $request request |
|
|
|
* @param ResponseInterface $response response |
|
|
|
*/ |
|
|
|
public function afterMethod(RequestInterface $request, ResponseInterface $response): void { |
|
|
|
if ($user = $this->userSession->getUser()) { |
|
|
|
$response->setHeader('X-User-Id', $user->getUID()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -51,6 +51,7 @@ use OCA\DAV\Connector\Sabre\QuotaPlugin; |
|
|
|
use OCA\DAV\Connector\Sabre\RequestIdHeaderPlugin; |
|
|
|
use OCA\DAV\Connector\Sabre\SharesPlugin; |
|
|
|
use OCA\DAV\Connector\Sabre\TagsPlugin; |
|
|
|
use OCA\DAV\Connector\Sabre\UserIdHeaderPlugin; |
|
|
|
use OCA\DAV\Connector\Sabre\ZipFolderPlugin; |
|
|
|
use OCA\DAV\DAV\CustomPropertiesBackend; |
|
|
|
use OCA\DAV\DAV\PublicAuth; |
|
|
|
@ -243,6 +244,7 @@ class Server { |
|
|
|
// performance improvement plugins
|
|
|
|
$this->server->addPlugin(new CopyEtagHeaderPlugin()); |
|
|
|
$this->server->addPlugin(new RequestIdHeaderPlugin(\OCP\Server::get(IRequest::class))); |
|
|
|
$this->server->addPlugin(new UserIdHeaderPlugin(\OCP\Server::get(IUserSession::class))); |
|
|
|
$this->server->addPlugin(new UploadAutoMkcolPlugin()); |
|
|
|
$this->server->addPlugin(new ChunkingV2Plugin(\OCP\Server::get(ICacheFactory::class))); |
|
|
|
$this->server->addPlugin(new ChunkingPlugin()); |
|
|
|
|