SEBSERV-239

This commit is contained in:
anhefti 2021-11-02 10:04:57 +01:00
parent 39cac216e0
commit daeb118210
5 changed files with 12 additions and 11 deletions

View file

@ -128,9 +128,9 @@ public final class Indicator implements Entity {
this.thresholds = Utils.immutableListOf(thresholds); this.thresholds = Utils.immutableListOf(thresholds);
} }
public Indicator(final Exam exam, final POSTMapper postParams) { public Indicator(final Long examId, final POSTMapper postParams) {
this.id = null; this.id = null;
this.examId = exam.id; this.examId = examId;
this.name = postParams.getString(Domain.INDICATOR.ATTR_NAME); this.name = postParams.getString(Domain.INDICATOR.ATTR_NAME);
this.type = postParams.getEnum(Domain.INDICATOR.ATTR_TYPE, IndicatorType.class); this.type = postParams.getEnum(Domain.INDICATOR.ATTR_TYPE, IndicatorType.class);
this.defaultColor = postParams.getString(Domain.INDICATOR.ATTR_COLOR); this.defaultColor = postParams.getString(Domain.INDICATOR.ATTR_COLOR);

View file

@ -131,7 +131,8 @@ public class ExamAPI_V1_Controller {
.map(this::createRunningExamInfo) .map(this::createRunningExamInfo)
.collect(Collectors.toList()); .collect(Collectors.toList());
} else { } else {
final Exam exam = this.examSessionService.getExamDAO().byPK(examId) final Exam exam = this.examSessionService.getExamDAO()
.byPK(examId)
.getOrThrow(); .getOrThrow();
result = Arrays.asList(createRunningExamInfo(exam)); result = Arrays.asList(createRunningExamInfo(exam));

View file

@ -327,7 +327,7 @@ public class ExamProctoringController {
this.authorizationService.checkRead(this.examSessionService this.authorizationService.checkRead(this.examSessionService
.getExamDAO() .getExamDAO()
.byPK(examId) .examGrantEntityByPK(examId)
.getOrThrow()); .getOrThrow());
} }

View file

@ -72,11 +72,10 @@ public class IndicatorController extends EntityController<Indicator, Indicator>
@Override @Override
protected Indicator createNew(final POSTMapper postParams) { protected Indicator createNew(final POSTMapper postParams) {
final Long examId = postParams.getLong(Domain.INDICATOR.ATTR_EXAM_ID); final Long examId = postParams.getLong(Domain.INDICATOR.ATTR_EXAM_ID);
if (examId == null) {
return this.examDao throw new RuntimeException("Missing exam model id from request parameter map!");
.byPK(examId) }
.map(exam -> new Indicator(exam, postParams)) return new Indicator(examId, postParams);
.getOrThrow();
} }
@Override @Override
@ -120,7 +119,8 @@ public class IndicatorController extends EntityController<Indicator, Indicator>
return null; return null;
} }
return this.examDao.byPK(entity.examId) return this.examDao
.examGrantEntityByPK(entity.examId)
.getOrThrow(); .getOrThrow();
} }

View file

@ -22,7 +22,7 @@ sebserver.webservice.clean-db-on-startup=false
# webservice configuration # webservice configuration
sebserver.init.adminaccount.gen-on-init=false sebserver.init.adminaccount.gen-on-init=false
sebserver.webservice.distributed=true sebserver.webservice.distributed=false
sebserver.webservice.master.delay.threshold=10000 sebserver.webservice.master.delay.threshold=10000
sebserver.webservice.http.external.scheme=http sebserver.webservice.http.external.scheme=http
sebserver.webservice.http.external.servername=localhost sebserver.webservice.http.external.servername=localhost