SEBSERV-354 fixed

This commit is contained in:
anhefti 2022-10-20 09:58:09 +02:00
parent 6a4924d169
commit 019f9e1421
3 changed files with 12 additions and 11 deletions

View file

@ -35,7 +35,7 @@ public interface SEBRestrictionAPI {
/** Use this to check if there is a SEB restriction available on the LMS for the specified exam.
*
* A SEB Restriction is available if there it can get from LMS and if there is either a Config-Key
* A SEB Restriction is available if it can get from LMS and if there is either a Config-Key
* or a BrowserExam-Key set or both. If none of this keys is set, the SEB Restriction is been
* considered to not set on the LMS.
*

View file

@ -197,6 +197,7 @@ public class SEBRestrictionServiceImpl implements SEBRestrictionService {
log.info("ExamStartedEvent received, process applySEBClientRestriction...");
applySEBClientRestriction(event.exam)
.flatMap(e -> this.examDAO.setSEBRestriction(e.id, true))
.onError(error -> log.error(
"Failed to apply SEB restrictions for started exam: {}",
event.exam,

View file

@ -129,11 +129,12 @@ public class ExamConfigUpdateServiceImpl implements ExamConfigUpdateService {
// generate the new Config Key and update the Config Key within the LMSSetup API for each exam (delete old Key and add new Key)
for (final Exam exam : exams) {
if (exam.getStatus() == ExamStatus.RUNNING || this.examAdminService.isRestricted(exam).getOr(false)) {
if (exam.getStatus() == ExamStatus.RUNNING) {
this.examUpdateHandler
.getSEBRestrictionService()
.applySEBClientRestriction(exam)
.flatMap(e -> this.examDAO.setSEBRestriction(e.id, true))
.onError(t -> log.error("Failed to update SEB Client restriction for Exam: {}", exam, t));
}
}
@ -201,15 +202,14 @@ public class ExamConfigUpdateServiceImpl implements ExamConfigUpdateService {
.getOrThrow();
// update seb client restriction if the feature is activated for the exam
if (this.examAdminService.isRestricted(exam).getOr(false)) {
this.examUpdateHandler
.getSEBRestrictionService()
.applySEBClientRestriction(exam)
.onError(t -> log.error(
"Failed to update SEB Client restriction for Exam: {}",
exam,
t));
}
this.examUpdateHandler
.getSEBRestrictionService()
.applySEBClientRestriction(exam)
.flatMap(e -> this.examDAO.setSEBRestriction(e.id, true))
.onError(t -> log.error(
"Failed to update SEB Client restriction for Exam: {}",
exam,
t));
// flush the exam cache. If there was an error during flush, it is logged but this process goes on
// and the saved changes are not rolled back