|
|
@@ -64,16 +64,6 @@ public class ExamController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @RequiresPermissions("tasks:view")
|
|
|
- @RequestMapping(value = "/api/test/exams", method = RequestMethod.GET)
|
|
|
- public List<ExamVO> getExams() {
|
|
|
- if (!SecurityUtils.getSubject().isPermitted("tasks:view")) {
|
|
|
- throw new UnauthorizedException("unauthorized");
|
|
|
- }
|
|
|
- String username = (String) SecurityUtils.getSubject().getPrincipals().getPrimaryPrincipal();
|
|
|
- return examLogic.getExamList(username);
|
|
|
- }
|
|
|
-
|
|
|
@RequiresPermissions("task:view")
|
|
|
@RequestMapping(value = "api/exam/{examId}", method = RequestMethod.GET)
|
|
|
public ExamVO getExamById(@PathVariable Long examId) {
|
|
|
@@ -108,6 +98,17 @@ public class ExamController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@RequiresPermissions("task:update")
|
|
|
+ @RequestMapping(value = "api/exam2paper/{examId}/{paperId}", method = RequestMethod.DELETE)
|
|
|
+ public Boolean deleteExam2Paper(@PathVariable Long examId, @PathVariable Long paperId) {
|
|
|
+ User user = (User) SecurityUtils.getSubject().getSession().getAttribute("User");
|
|
|
+ String examPermissionStr = user.getId().toString() + ":task:update:" + examId.toString();
|
|
|
+ if (!SecurityUtils.getSubject().isPermitted(new TaskPermission(examPermissionStr))) {
|
|
|
+ throw new UnauthorizedException("unauthorized");
|
|
|
+ }
|
|
|
+ return examLogic.deleteExam2Paper(examId, paperId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequiresPermissions("task:update")
|
|
|
@RequestMapping(value = "api/exam/{examId}", method = RequestMethod.PUT)
|
|
|
public ExamVO update(@PathVariable Long examId, @RequestBody ExamVO examVO) {
|
|
|
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("User");
|