From 2a851fc24316568870f1a9e7d3feeeefc1d946d1 Mon Sep 17 00:00:00 2001 From: kkfluous Date: Thu, 30 Apr 2026 18:03:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(auth):=20=E8=83=BD=E6=BA=90=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=94=BE=E5=BC=80=E5=85=A8=E9=87=8F=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E8=AE=BF=E9=97=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BI-LEADER-ENERGY 之外,FULL_ACCESS_ROLES(所有权限/数智中心/BI-Leader) 也可访问能源管理模块。 Co-Authored-By: Claude Opus 4.7 (1M context) --- src/shared/auth/roles.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/auth/roles.ts b/src/shared/auth/roles.ts index 060dd47..2b26b7b 100644 --- a/src/shared/auth/roles.ts +++ b/src/shared/auth/roles.ts @@ -28,8 +28,8 @@ export function canManageFeedback(roles: readonly string[] | null | undefined): return roles.some(r => FEEDBACK_ADMIN_ROLES.includes(r) || FULL_ACCESS_ROLES.includes(r)); } -/** 用户是否可访问能源管理模块。仅 BI-LEADER-ENERGY 角色允许访问。 */ +/** 用户是否可访问能源管理模块。BI-LEADER-ENERGY 或全量权限角色可访问。 */ export function canAccessEnergy(roles: readonly string[] | null | undefined): boolean { if (!roles || roles.length === 0) return false; - return roles.some(r => ENERGY_ACCESS_ROLES.includes(r)); + return roles.some(r => ENERGY_ACCESS_ROLES.includes(r) || FULL_ACCESS_ROLES.includes(r)); }