Files
agent-desktop/console
Pine b0ffd9940b fix: 全方位身份权限审查与修复
1. PortSwitchGuard 修复:
   - 移除对已废弃后端接口 /auth/select-identity 的调用
   - 改为 authStore.selectIdentity 纯前端切换,不重新签发 JWT
   - 符合'身份始终由一个JWT管理'的原则

2. Header/Sidebar 身份切换修复:
   - 同样改为纯前端切换,不调用后端
   - 移除 setSwitchingPort 状态(不再需要)

3. 登录流程修复:
   - 移除多身份选择弹窗,JWT 始终包含所有身份的叠加能力
   - 登录后直接进入系统,身份切换在应用内通过 IdentitySwitcher 完成
   - 移除 handleSelectIdentity、identityCandidates 状态、PORT_LABEL_KEY 常量

4. 前端权限判断修复:
   - hasPermission 添加平台管理员全权限判断(与后端 permission_granted 一致)
   - role=operator 或 capabilities 包含 operator 时恒返回 true

5. 移除 authApi.selectIdentity 方法(后端接口已移除)

身份模型确认:
- 服务端: 叠加制能力模型(capabilities),JWT 包含所有身份的叠加能力
- IM端: is_member 根据 biz_type 调用 is_park_member/is_enterprise_member
- 桌面端: authStore 管理身份状态,selectIdentity 纯前端切换
2026-09-14 00:08:11 +08:00
..