feat: add header with user id in response

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/55503/head
Robin Appelman 2025-09-18 18:30:04 +07:00
parent 467c07904e
commit eb03573dff
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);
}