Merge remote-tracking branch 'origin/dev-1.4' into development
This commit is contained in:
commit
c17fe84043
5 changed files with 25 additions and 20 deletions
|
@ -742,14 +742,20 @@ public class ExamDAOImpl implements ExamDAO {
|
||||||
|
|
||||||
private QuizData saveAdditionalQuizAttributes(final Long examId, final QuizData quizData) {
|
private QuizData saveAdditionalQuizAttributes(final Long examId, final QuizData quizData) {
|
||||||
final Map<String, String> additionalAttributes = new HashMap<>(quizData.getAdditionalAttributes());
|
final Map<String, String> additionalAttributes = new HashMap<>(quizData.getAdditionalAttributes());
|
||||||
additionalAttributes.put(QuizData.QUIZ_ATTR_DESCRIPTION, quizData.description);
|
if (StringUtils.isNotBlank(quizData.description)) {
|
||||||
additionalAttributes.put(QuizData.QUIZ_ATTR_START_URL, quizData.startURL);
|
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(
|
if (!additionalAttributes.isEmpty()) {
|
||||||
EntityType.EXAM,
|
this.additionalAttributesDAO.saveAdditionalAttributes(
|
||||||
examId,
|
EntityType.EXAM,
|
||||||
additionalAttributes)
|
examId,
|
||||||
.getOrThrow();
|
additionalAttributes)
|
||||||
|
.getOrThrow();
|
||||||
|
}
|
||||||
|
|
||||||
return quizData;
|
return quizData;
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,8 +135,6 @@ public class UserDAOImpl implements UserDAO {
|
||||||
this.userRecordMapper
|
this.userRecordMapper
|
||||||
.selectByExample()
|
.selectByExample()
|
||||||
.where(UserRecordDynamicSqlSupport.username, isEqualTo(username))
|
.where(UserRecordDynamicSqlSupport.username, isEqualTo(username))
|
||||||
.and(UserRecordDynamicSqlSupport.active,
|
|
||||||
isEqualTo(BooleanUtils.toInteger(true)))
|
|
||||||
.build()
|
.build()
|
||||||
.execute())
|
.execute())
|
||||||
.flatMap(this::sebServerUserFromRecord);
|
.flatMap(this::sebServerUserFromRecord);
|
||||||
|
|
|
@ -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.
|
/** 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
|
* 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.
|
* considered to not set on the LMS.
|
||||||
*
|
*
|
||||||
|
|
|
@ -197,6 +197,7 @@ public class SEBRestrictionServiceImpl implements SEBRestrictionService {
|
||||||
log.info("ExamStartedEvent received, process applySEBClientRestriction...");
|
log.info("ExamStartedEvent received, process applySEBClientRestriction...");
|
||||||
|
|
||||||
applySEBClientRestriction(event.exam)
|
applySEBClientRestriction(event.exam)
|
||||||
|
.flatMap(e -> this.examDAO.setSEBRestriction(e.id, true))
|
||||||
.onError(error -> log.error(
|
.onError(error -> log.error(
|
||||||
"Failed to apply SEB restrictions for started exam: {}",
|
"Failed to apply SEB restrictions for started exam: {}",
|
||||||
event.exam,
|
event.exam,
|
||||||
|
|
|
@ -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)
|
// 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) {
|
for (final Exam exam : exams) {
|
||||||
if (exam.getStatus() == ExamStatus.RUNNING || this.examAdminService.isRestricted(exam).getOr(false)) {
|
if (exam.getStatus() == ExamStatus.RUNNING) {
|
||||||
|
|
||||||
this.examUpdateHandler
|
this.examUpdateHandler
|
||||||
.getSEBRestrictionService()
|
.getSEBRestrictionService()
|
||||||
.applySEBClientRestriction(exam)
|
.applySEBClientRestriction(exam)
|
||||||
|
.flatMap(e -> this.examDAO.setSEBRestriction(e.id, true))
|
||||||
.onError(t -> log.error("Failed to update SEB Client restriction for Exam: {}", exam, t));
|
.onError(t -> log.error("Failed to update SEB Client restriction for Exam: {}", exam, t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,15 +202,14 @@ public class ExamConfigUpdateServiceImpl implements ExamConfigUpdateService {
|
||||||
.getOrThrow();
|
.getOrThrow();
|
||||||
|
|
||||||
// update seb client restriction if the feature is activated for the exam
|
// update seb client restriction if the feature is activated for the exam
|
||||||
if (this.examAdminService.isRestricted(exam).getOr(false)) {
|
this.examUpdateHandler
|
||||||
this.examUpdateHandler
|
.getSEBRestrictionService()
|
||||||
.getSEBRestrictionService()
|
.applySEBClientRestriction(exam)
|
||||||
.applySEBClientRestriction(exam)
|
.flatMap(e -> this.examDAO.setSEBRestriction(e.id, true))
|
||||||
.onError(t -> log.error(
|
.onError(t -> log.error(
|
||||||
"Failed to update SEB Client restriction for Exam: {}",
|
"Failed to update SEB Client restriction for Exam: {}",
|
||||||
exam,
|
exam,
|
||||||
t));
|
t));
|
||||||
}
|
|
||||||
|
|
||||||
// flush the exam cache. If there was an error during flush, it is logged but this process goes on
|
// 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
|
// and the saved changes are not rolled back
|
||||||
|
|
Loading…
Reference in a new issue