Commit 04355d28 authored by wujipeng's avatar wujipeng
Browse files

教师端-教学管理-教案管理

parent 98e0a708
...@@ -58,4 +58,21 @@ public class AuthenticatedUserService { ...@@ -58,4 +58,21 @@ public class AuthenticatedUserService {
throw new BusinessException("只有管理员可以发布平台消息"); throw new BusinessException("只有管理员可以发布平台消息");
} }
} }
/**
* 校验当前用户是否具备教师角色。
*
* <p>教案内容不绑定具体排课,因此不能通过 class_subject 反向证明教师身份;
* 必须使用项目现有 phone_role 角色映射进行入口权限校验。</p>
*/
public void requireTeacher(UserEntity user) {
if (user == null) {
throw new BusinessException("当前登录用户不存在");
}
List<SysPhoneRoleEntity> roles = phoneRoleService.queryByPhone(user.getPhoneNumber());
boolean teacher = roles != null && roles.stream().anyMatch(role -> "教师".equals(role.getRoleName()));
if (!teacher) {
throw new BusinessException("只有教师可以访问教案管理接口");
}
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment