From 9d55564073fcc9dd3e7c68b622702d581a7e7d53 Mon Sep 17 00:00:00 2001 From: beilunyang <786220806@qq.com> Date: Fri, 6 Jun 2025 00:04:23 +0800 Subject: [PATCH] fix: the duke can not be used as the default role --- app/lib/auth.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/lib/auth.ts b/app/lib/auth.ts index 15a13ba..0003900 100644 --- a/app/lib/auth.ts +++ b/app/lib/auth.ts @@ -21,7 +21,16 @@ const ROLE_DESCRIPTIONS: Record = { const getDefaultRole = async (): Promise => { const defaultRole = await getRequestContext().env.SITE_CONFIG.get("DEFAULT_ROLE") - return defaultRole === ROLES.KNIGHT ? ROLES.KNIGHT : ROLES.CIVILIAN + + if ( + defaultRole === ROLES.DUKE || + defaultRole === ROLES.KNIGHT || + defaultRole === ROLES.CIVILIAN + ) { + return defaultRole as Role + } + + return ROLES.CIVILIAN } async function findOrCreateRole(db: Db, roleName: Role) {