添加考试的权限校验

This commit is contained in:
thesai 2021-01-12 18:12:50 +08:00
parent 62739021be
commit 4c23708d14
3 changed files with 12 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.*; import club.joylink.rtss.dao.*;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.*; import club.joylink.rtss.vo.client.*;
import club.joylink.rtss.vo.client.company.DepartmentVO; import club.joylink.rtss.vo.client.company.DepartmentVO;
@ -60,6 +61,9 @@ public class ExamService implements IExamService{
@Autowired @Autowired
private IMapService iMapService; private IMapService iMapService;
@Autowired
private GroupSimulationService groupSimulationService;
/** /**
* 创建考试定义 * 创建考试定义
*/ */
@ -330,10 +334,10 @@ public class ExamService implements IExamService{
}); });
examsLessonVO.setExamDefinitionList(examDefinitionVOList); examsLessonVO.setExamDefinitionList(examDefinitionVOList);
// 设置权限 // 设置权限
// List<UserPermissionVO> voList = userPermissionService.findTeachVOByMapIdAndUserId(lessonVO.getMapId(), userVO.getId()); examsLessonVO.setAvailable(groupSimulationService.hasPermission(userVO, lessonVO.getMapId(), lessonVO.getPrdType()));
List<UserPermissionVO> examPermissions = this.iUserPermissionService.getExamUserPermission(userVO, // List<UserPermissionVO> examPermissions = this.iUserPermissionService.getExamUserPermission(userVO,
lessonVO.getMapId(), lessonVO.getPrdType(), lessonId); // lessonVO.getMapId(), lessonVO.getPrdType(), lessonId);
examsLessonVO.setPermissionList(examPermissions); // examsLessonVO.setPermissionList(examPermissions);
return examsLessonVO; return examsLessonVO;
} }

View File

@ -110,7 +110,7 @@ public class LessonService implements ILessonService {
trainingVOList = iTrainingV1Service.queryByIds(trainingIds); trainingVOList = iTrainingV1Service.queryByIds(trainingIds);
} }
// 查询权限 // 查询权限
boolean valid = groupSimulationService.hasPermission(userVO, lessonVO.getMapId(), null); boolean valid = groupSimulationService.hasPermission(userVO, lessonVO.getMapId(), lessonVO.getPrdType());
// 生成tree // 生成tree
lessonTreeVO.setTree(TreeNode.buildValidLessonTrainingTree(lessonVO, chapterVOList, trainingVOList, relVOList, valid)); lessonTreeVO.setTree(TreeNode.buildValidLessonTrainingTree(lessonVO, chapterVOList, trainingVOList, relVOList, valid));
// lessonTreeVO.setPermissionList(permissionVOList); // lessonTreeVO.setPermissionList(permissionVOList);

View File

@ -75,6 +75,9 @@ public class ExamsLessonVO {
private boolean systemFault; private boolean systemFault;
/** 用户是否有权使用改考试 */
private boolean available;
public ExamsLessonVO(LessonVO lessonVO) { public ExamsLessonVO(LessonVO lessonVO) {
this.id = lessonVO.getId(); this.id = lessonVO.getId();
this.name = lessonVO.getName(); this.name = lessonVO.getName();