Merge remote-tracking branch 'origin/dev-1.4' into development

This commit is contained in:
anhefti 2022-10-20 10:03:47 +02:00
commit c17fe84043
5 changed files with 25 additions and 20 deletions

View file

@ -742,14 +742,20 @@ public class ExamDAOImpl implements ExamDAO {
private QuizData saveAdditionalQuizAttributes(final Long examId, final QuizData quizData) {
final Map<String, String> additionalAttributes = new HashMap<>(quizData.getAdditionalAttributes());
additionalAttributes.put(QuizData.QUIZ_ATTR_DESCRIPTION, quizData.description);
additionalAttributes.put(QuizData.QUIZ_ATTR_START_URL, quizData.startURL);
if (StringUtils.isNotBlank(quizData.description)) {
additionalAttributes.put(QuizData.QUIZ_ATTR_DESCRIPTION, quizData.description);
}
if (StringUtils.isNotBlank(quizData.startURL)) {
additionalAttributes.put(QuizData.QUIZ_ATTR_START_URL, quizData.startURL);
}
this.additionalAttributesDAO.saveAdditionalAttributes(
EntityType.EXAM,
examId,
additionalAttributes)
.getOrThrow();
if (!additionalAttributes.isEmpty()) {
this.additionalAttributesDAO.saveAdditionalAttributes(
EntityType.EXAM,
examId,
additionalAttributes)
.getOrThrow();
}
return quizData;
}

View file

@ -135,8 +135,6 @@ public class UserDAOImpl implements UserDAO {
this.userRecordMapper
.selectByExample()
.where(UserRecordDynamicSqlSupport.username, isEqualTo(username))
.and(UserRecordDynamicSqlSupport.active,
isEqualTo(BooleanUtils.toInteger(true)))
.build()
.execute())
.flatMap(this::sebServerUserFromRecord);

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