Merge pull request #55503 from nextcloud/backport/55176/stable31

[stable31] feat: add header with user id in response
pull/55616/head
Robin Appelman 2025-10-07 15:23:37 +07:00 committed by GitHub
commit 82072ac750
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

@ -11,6 +11,7 @@ use OCP\AppFramework\Http;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;
/**
@ -246,6 +247,11 @@ class Response {
$mergeWith['ETag'] = '"' . $this->ETag . '"';
}
$userSession = \OC::$server->get(IUserSession::class);
if ($user = $userSession->getUser()) {
$mergeWith['X-User-Id'] = $user->getUID();
}
return array_merge($mergeWith, $this->headers);
}