Skip to content

Commit

Permalink
fix: endUser createToken
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Oct 30, 2023
1 parent cfa9a80 commit 99a4574
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/engine-backend/router/endUserRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ function asEndUser(
message: 'Current viewer missing orgId to create token',
})
}
if (viewer.role === 'end_user' && input.endUserId !== viewer.endUserId) {
if (
viewer.role === 'end_user' &&
input.endUserId &&
input.endUserId !== viewer.endUserId
) {
throw new TRPCError({
code: 'FORBIDDEN',
message: 'Current viewer cannot create token for other end user',
Expand Down

0 comments on commit 99a4574

Please sign in to comment.