diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java index 082f41aa..6ff20ca6 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java @@ -8,17 +8,13 @@ package ch.ethz.seb.sebserver.webservice.weblayer.api; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; import javax.validation.Valid; +import ch.ethz.seb.sebserver.gbl.util.Cryptor; import ch.ethz.seb.sebserver.webservice.servicelayer.exam.ExamConfigurationValueService; import ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl.NoSEBRestrictionException; import org.apache.commons.lang3.StringUtils; @@ -98,6 +94,7 @@ public class ExamAdministrationController extends EntityController { private final ExamSessionService examSessionService; private final SEBRestrictionService sebRestrictionService; private final SecurityKeyService securityKeyService; + private final Cryptor cryptor; public ExamAdministrationController( final AuthorizationService authorization, @@ -113,7 +110,8 @@ public class ExamAdministrationController extends EntityController { final ExamTemplateService examTemplateService, final ExamSessionService examSessionService, final SEBRestrictionService sebRestrictionService, - final SecurityKeyService securityKeyService) { + final SecurityKeyService securityKeyService, + final Cryptor cryptor) { super(authorization, bulkActionService, @@ -131,6 +129,7 @@ public class ExamAdministrationController extends EntityController { this.examSessionService = examSessionService; this.sebRestrictionService = sebRestrictionService; this.securityKeyService = securityKeyService; + this.cryptor = cryptor; } @Override @@ -710,14 +709,14 @@ public class ExamAdministrationController extends EntityController { private Exam checkQuitPasswordChange(final Exam exam) { if (this.examSessionService.isExamRunning(exam.id) && examSessionService.hasActiveSEBClientConnections(exam.id)) { - final Exam oldExam = this.examDAO.byPK(exam.id).getOrThrow(); - if (!oldExam.quitPassword.equals(exam.quitPassword)) { + final CharSequence pwd = cryptor.decrypt(oldExam.quitPassword).getOr(oldExam.quitPassword); + if (!Objects.equals(pwd, exam.quitPassword)) { throw new APIMessageException(APIMessage.fieldValidationError( new FieldError( EXAM.ATTR_QUIT_PASSWORD, EXAM.ATTR_QUIT_PASSWORD, - "exam:quitPassword:changeDenied:"))); + "exam:quitPassword:changeDeniedActiveClients:"))); } } return exam; diff --git a/src/main/resources/config/application-dev-gui.properties b/src/main/resources/config/application-dev-gui.properties index a0194445..58cfaa5b 100644 --- a/src/main/resources/config/application-dev-gui.properties +++ b/src/main/resources/config/application-dev-gui.properties @@ -1,11 +1,11 @@ server.address=localhost -server.port=8090 +server.port=8080 sebserver.gui.http.external.scheme=http sebserver.gui.entrypoint=/gui sebserver.gui.webservice.protocol=http sebserver.gui.webservice.address=localhost -sebserver.gui.webservice.port=8090 +sebserver.gui.webservice.port=8080 sebserver.gui.webservice.apipath=/admin-api/v1 # defines the polling interval that is used to poll the webservice for client connection data on a monitored exam page sebserver.gui.webservice.poll-interval=1000 diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index 4785337b..714920b9 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -120,6 +120,7 @@ sebserver.form.validation.fieldError.invalidIPRange=Invalid IP-address range sebserver.form.validation.fieldError.url.noAccess=Access was denied sebserver.form.validation.fieldError.invalidDateRange=Invalid Date Range sebserver.form.validation.fieldError.endBeforeStart=Invalid Date Range, End before Start +sebserver.form.validation.fieldError.changeDeniedActiveClients=Cannot be changed while there are active SEB client connection sebserver.error.unexpected=Unexpected Error sebserver.page.message=Information sebserver.dialog.confirm.title=Confirmation