mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
Merge pull request #55503 from nextcloud/backport/55176/stable31
[stable31] feat: add header with user id in response
This commit is contained in:
commit
82072ac750
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