fix(admin): allow fetching current user without elevated ACL (#3)

This commit is contained in:
hampus-fluxer
2026-01-03 00:47:06 +01:00
committed by GitHub
parent b997d3b263
commit 275126d61b
2 changed files with 47 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ import {
ListUserGuildsRequest,
ListUserSessionsRequest,
LookupUserRequest,
mapUserToAdminResponse,
ScheduleAccountDeletionRequest,
SendPasswordResetRequest,
SetUserAclsRequest,
@@ -50,6 +51,14 @@ import {
} from '../AdminModel';
export const UserAdminController = (app: HonoApp) => {
app.get('/admin/users/me', requireAdminACL(AdminACLs.AUTHENTICATE), async (ctx) => {
const adminUser = ctx.get('user');
const cacheService = ctx.get('cacheService');
return ctx.json({
user: await mapUserToAdminResponse(adminUser, cacheService),
});
});
app.post(
'/admin/users/lookup',
RateLimitMiddleware(RateLimitConfigs.ADMIN_LOOKUP),