Skip to content

Commit 4308fab

Browse files
Merge pull request #58440 from nextcloud/backport/58144/stable33
[stable33] Fix/more missing userid cases
2 parents 27475e9 + a93ef85 commit 4308fab

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

apps/dav/lib/Connector/Sabre/UserIdHeaderPlugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct(
1919
}
2020

2121
public function initialize(\Sabre\DAV\Server $server): void {
22-
$server->on('afterMethod:*', [$this, 'afterMethod']);
22+
$server->on('beforeMethod:*', [$this, 'beforeMethod']);
2323
}
2424

2525
/**
@@ -28,7 +28,7 @@ public function initialize(\Sabre\DAV\Server $server): void {
2828
* @param RequestInterface $request request
2929
* @param ResponseInterface $response response
3030
*/
31-
public function afterMethod(RequestInterface $request, ResponseInterface $response): void {
31+
public function beforeMethod(RequestInterface $request, ResponseInterface $response): void {
3232
if ($user = $this->userSession->getUser()) {
3333
$response->setHeader('X-User-Id', $user->getUID());
3434
}

lib/base.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,9 @@ public static function handleRequest(): void {
11901190
// Redirect to the default app or login only as an entry point
11911191
if ($requestPath === '') {
11921192
// Someone is logged in
1193-
if (Server::get(IUserSession::class)->isLoggedIn()) {
1193+
$userSession = Server::get(IUserSession::class);
1194+
if ($userSession->isLoggedIn()) {
1195+
header('X-User-Id: ' . $userSession->getUser()?->getUID());
11941196
header('Location: ' . Server::get(IURLGenerator::class)->linkToDefaultPageUrl());
11951197
} else {
11961198
// Not handled and not logged in

0 commit comments

Comments
 (0)