Merge pull request #52699 from nextcloud/fix/noid/AppAPI-invalid-userId

fix(webhooks_listener): correctly set userId from event
pull/51081/head
Alexander Piskun 2025-05-09 13:37:01 +07:00 committed by GitHub
commit c7430d5cb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

@ -74,7 +74,8 @@ class WebhookCall extends QueuedJob {
} elseif (!$exApp['enabled']) {
throw new RuntimeException('ExApp ' . $exAppId . ' is disabled.');
}
$response = $appApiFunctions->exAppRequest($exAppId, $webhookUri, $webhookListener->getUserId(), $webhookListener->getHttpMethod(), [], $options);
$userId = ($data['user'] ?? [])['uid'] ?? null;
$response = $appApiFunctions->exAppRequest($exAppId, $webhookUri, $userId, $webhookListener->getHttpMethod(), [], $options);
if (is_array($response) && isset($response['error'])) {
throw new RuntimeException(sprintf('Error during request to ExApp(%s): %s', $exAppId, $response['error']));
}

@ -41,6 +41,7 @@ class WebhooksEventListener implements IEventListener {
// TODO add group membership to be able to filter on it
$data = [
'event' => $this->serializeEvent($event),
/* Do not remove 'user' from here, see BackgroundJobs/WebhookCall.php */
'user' => (is_null($user) ? null : JsonSerializer::serializeUser($user)),
'time' => time(),
];