feat: add header with user id in response

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2025-09-18 18:30:04 +02:00
parent 467c07904e
commit eb03573dff

View file

@ -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);
}