diff --git a/Operation/ExchangeToken.php b/Operation/ExchangeToken.php index a390b3d..c35891c 100644 --- a/Operation/ExchangeToken.php +++ b/Operation/ExchangeToken.php @@ -93,13 +93,14 @@ public function execute(string $inputToken, string $username): string $tokenChain[] = $parentAdminTokenPayload['onBehalfOf']; } $tokenChain[] = $parentAdminTokenPayload['iden']; + $payload['onBehalfOf'] = implode(' > ', $tokenChain); + $payload['onBehalfOfIds'] = []; if (isset($parentAdminTokenPayload['onBehalfOfIds'])) { $payload['onBehalfOfIds'] = $parentAdminTokenPayload['onBehalfOfIds']; } - $payload['onBehalfOfIds'][] = $targetAdmin->getId(); + $payload['onBehalfOfIds'][] = $parentAdminTokenPayload['id'] ?? -1; - $payload['onBehalfOf'] = implode(' > ', $tokenChain); $payload['iden'] = (string) $targetAdmin; $event->setData($payload); @@ -119,4 +120,4 @@ public function execute(string $inputToken, string $username): string return $newToken; } -} +} \ No newline at end of file