fix(auth): 能源管理仅 BI-LEADER-ENERGY 与「所有权限」可访问
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
收紧准入:之前 FULL_ACCESS_ROLES(含 数智中心 / BI-Leader)会自动通过。 现在只接受 BI-LEADER-ENERGY 或「所有权限」两类角色。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -28,8 +28,9 @@ 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 或「所有权限」可访问。 */
|
||||
const ENERGY_FULL_ACCESS = '所有权限';
|
||||
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) || FULL_ACCESS_ROLES.includes(r));
|
||||
return roles.some(r => ENERGY_ACCESS_ROLES.includes(r) || r === ENERGY_FULL_ACCESS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user