feat(authz): 重写权限模板分配与班级授权边界

拆分能力、分配范围和业务关系,固定管理员能力并收紧组织级写入口。
补齐内容、课表、设备会话和实时通道授权,兼容旧库分配及历史快照。
重写权限分配预览,按实际可操作范围展示维护入口,合并学生入口并独立学年升级页。
增加授权攻击矩阵及静态门禁,更新隔离回归与开发契约。

验证:授权矩阵 23 段通过,Node 24 下 Web 63/63,类型检查、lint 与文档严格构建通过。
This commit is contained in:
LoveChengke committed 2026-10-31 09:40:23 +08:00
1 parent 682818dd4a
commit 66be3a63b1
115 files changed
+4463 -2747

No files matched your search

+18
View File
@@ -493,6 +493,22 @@ export const SOCKET_EVENTS = {
connected: 'connected',
} as const;
/** 班级事件域;订阅资格按对应读能力逐域求值。 */
export const SOCKET_CHANNELS = ['core', 'homework', 'notification', 'grade', 'courseware'] as const;
export type SocketChannel = (typeof SOCKET_CHANNELS)[number];
export const SOCKET_EVENT_CHANNELS: Record<string, SocketChannel> = {
'class:updated': 'core',
'schedule:updated': 'core',
'homework:new': 'homework',
'homework:updated': 'homework',
'homework:status': 'homework',
'notification:new': 'notification',
'notification:deleted': 'notification',
'call:new': 'notification',
'grade:updated': 'grade',
'courseware:changed': 'courseware',
};
/** ClassIsland JSON 导入:时间点类型(与 TimeLayoutItem.TimeType 一致) */
export const CLASSISLAND_TIME_TYPES = {
class: 0,
@@ -560,6 +576,8 @@ export function buildCallTitle(studentName: string, teacherName: string): string
/** Socket.IO 房间名生成规则:与后端保持一致,客户端订阅时复用 */
export const SOCKET_ROOMS = {
classChannel: (classId: string, channel: SocketChannel): string => `class:${classId}:${channel}`,
/** @deprecated 仅供旧协议测试识别,生产不再订阅。 */
class: (classId: string): string => `class:${classId}`,
/**
* 会话自身的房间:老师/管理员是账号 id,ClassHelper 班级端是班级 id。