Skip to content

Commit 5a9de69

Browse files
msukkariclaude
andcommitted
fix(web): accept userId query param in GET /api/ee/user
Look up the specified user by ID instead of returning the authenticated user's own info. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e59b059 commit 5a9de69

File tree

1 file changed

+11
-4
lines changed
  • packages/web/src/app/api/(server)/ee/user

1 file changed

+11
-4
lines changed

packages/web/src/app/api/(server)/ee/user/route.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,20 @@ import { NextRequest } from "next/server";
1414
const logger = createLogger('ee-user-api');
1515
const auditService = getAuditService();
1616

17-
export const GET = apiHandler(async () => {
18-
const result = await withAuthV2(async ({ org, role, user, prisma }) => {
17+
export const GET = apiHandler(async (request: NextRequest) => {
18+
const url = new URL(request.url);
19+
const userId = url.searchParams.get('userId');
20+
21+
if (!userId) {
22+
return serviceErrorResponse(missingQueryParam('userId'));
23+
}
24+
25+
const result = await withAuthV2(async ({ org, role, prisma }) => {
1926
return withMinimumOrgRole(role, OrgRole.OWNER, async () => {
2027
try {
2128
const userData = await prisma.user.findUnique({
2229
where: {
23-
id: user.id,
30+
id: userId,
2431
},
2532
select: {
2633
name: true,
@@ -49,7 +56,7 @@ export const GET = apiHandler(async () => {
4956

5057
return userData;
5158
} catch (error) {
52-
logger.error('Error fetching user info', { error, userId: user.id });
59+
logger.error('Error fetching user info', { error, userId });
5360
throw error;
5461
}
5562
});

0 commit comments

Comments
 (0)