Skip to content

Commit 8caff3f

Browse files
committed
chore: change variables names and id field to search user in AuditEventListener
1 parent 28dd586 commit 8caff3f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

app/Audit/AuditEventListener.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,12 @@ private function getAuditStrategy($em): ?IAuditStrategy
9494
private function buildAuditContext(): AuditContext
9595
{
9696
$resourceCtx = app(IResourceServerContext::class);
97-
$userExternalId = $resourceCtx->getCurrentUserId();
98-
$member = null;
99-
if ($userExternalId) {
100-
$memberRepo = app(IUserRepository::class);
101-
$member = $memberRepo->findOneBy(["external_id" => $userExternalId]);
97+
$userId = $resourceCtx->getCurrentUserId();
98+
$user = null;
99+
$userId = 1;
100+
if ($userId) {
101+
$userRepo = app(IUserRepository::class);
102+
$user = $userRepo->getById($userId);
102103
}
103104

104105
//$ui = app()->bound('ui.context') ? app('ui.context') : [];
@@ -117,10 +118,10 @@ private function buildAuditContext(): AuditContext
117118
}
118119

119120
return new AuditContext(
120-
userId: $member?->getId(),
121-
userEmail: $member?->getEmail(),
122-
userFirstName: $member?->getFirstName(),
123-
userLastName: $member?->getLastName(),
121+
userId: $userId,
122+
userEmail: $user?->getEmail(),
123+
userFirstName: $user?->getFirstName(),
124+
userLastName: $user?->getLastName(),
124125
uiApp: $ui['app'] ?? null,
125126
uiFlow: $ui['flow'] ?? null,
126127
route: $req?->path(),

0 commit comments

Comments
 (0)