fix: return admin role from session endpoint when auth is disabled

The GET /api/auth/session endpoint still returned role "user" and
user-level permissions when AUTH_ENABLED=false, inconsistent with the
middleware which now assigns role "admin". Fix the session endpoint to
match so API clients get the correct role.
This commit is contained in:
SnapOtter
2026-05-16 12:25:28 +08:00
parent 4906865275
commit 0d0fd760e5
+2 -2
View File
@@ -297,9 +297,9 @@ export async function authRoutes(app: FastifyInstance): Promise<void> {
user: { user: {
id: "anonymous", id: "anonymous",
username: "anonymous", username: "anonymous",
role: "user", role: "admin",
mustChangePassword: false, mustChangePassword: false,
permissions: getPermissions("user"), permissions: getPermissions("admin"),
analyticsEnabled: null, analyticsEnabled: null,
analyticsConsentShownAt: null, analyticsConsentShownAt: null,
analyticsConsentRemindAt: null, analyticsConsentRemindAt: null,