mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 09:13:19 -04:00
feat: add header with user id in response
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue