SEBSERV-482 testing bugfix

This commit is contained in:
anhefti 2024-01-11 14:20:31 +01:00
parent ac21400388
commit 015cc9c5c9
3 changed files with 12 additions and 12 deletions

View file

@ -8,17 +8,13 @@
package ch.ethz.seb.sebserver.webservice.weblayer.api; package ch.ethz.seb.sebserver.webservice.weblayer.api;
import java.util.ArrayList; import java.util.*;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.validation.Valid; 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.exam.ExamConfigurationValueService;
import ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl.NoSEBRestrictionException; import ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl.NoSEBRestrictionException;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -98,6 +94,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
private final ExamSessionService examSessionService; private final ExamSessionService examSessionService;
private final SEBRestrictionService sebRestrictionService; private final SEBRestrictionService sebRestrictionService;
private final SecurityKeyService securityKeyService; private final SecurityKeyService securityKeyService;
private final Cryptor cryptor;
public ExamAdministrationController( public ExamAdministrationController(
final AuthorizationService authorization, final AuthorizationService authorization,
@ -113,7 +110,8 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
final ExamTemplateService examTemplateService, final ExamTemplateService examTemplateService,
final ExamSessionService examSessionService, final ExamSessionService examSessionService,
final SEBRestrictionService sebRestrictionService, final SEBRestrictionService sebRestrictionService,
final SecurityKeyService securityKeyService) { final SecurityKeyService securityKeyService,
final Cryptor cryptor) {
super(authorization, super(authorization,
bulkActionService, bulkActionService,
@ -131,6 +129,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
this.examSessionService = examSessionService; this.examSessionService = examSessionService;
this.sebRestrictionService = sebRestrictionService; this.sebRestrictionService = sebRestrictionService;
this.securityKeyService = securityKeyService; this.securityKeyService = securityKeyService;
this.cryptor = cryptor;
} }
@Override @Override
@ -710,14 +709,14 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
private Exam checkQuitPasswordChange(final Exam exam) { private Exam checkQuitPasswordChange(final Exam exam) {
if (this.examSessionService.isExamRunning(exam.id) && if (this.examSessionService.isExamRunning(exam.id) &&
examSessionService.hasActiveSEBClientConnections(exam.id)) { examSessionService.hasActiveSEBClientConnections(exam.id)) {
final Exam oldExam = this.examDAO.byPK(exam.id).getOrThrow(); 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( throw new APIMessageException(APIMessage.fieldValidationError(
new FieldError( new FieldError(
EXAM.ATTR_QUIT_PASSWORD, EXAM.ATTR_QUIT_PASSWORD,
EXAM.ATTR_QUIT_PASSWORD, EXAM.ATTR_QUIT_PASSWORD,
"exam:quitPassword:changeDenied:"))); "exam:quitPassword:changeDeniedActiveClients:")));
} }
} }
return exam; return exam;

View file

@ -1,11 +1,11 @@
server.address=localhost server.address=localhost
server.port=8090 server.port=8080
sebserver.gui.http.external.scheme=http sebserver.gui.http.external.scheme=http
sebserver.gui.entrypoint=/gui sebserver.gui.entrypoint=/gui
sebserver.gui.webservice.protocol=http sebserver.gui.webservice.protocol=http
sebserver.gui.webservice.address=localhost sebserver.gui.webservice.address=localhost
sebserver.gui.webservice.port=8090 sebserver.gui.webservice.port=8080
sebserver.gui.webservice.apipath=/admin-api/v1 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 # 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 sebserver.gui.webservice.poll-interval=1000

View file

@ -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.url.noAccess=Access was denied
sebserver.form.validation.fieldError.invalidDateRange=Invalid Date Range sebserver.form.validation.fieldError.invalidDateRange=Invalid Date Range
sebserver.form.validation.fieldError.endBeforeStart=Invalid Date Range, End before Start 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.error.unexpected=Unexpected Error
sebserver.page.message=Information sebserver.page.message=Information
sebserver.dialog.confirm.title=Confirmation sebserver.dialog.confirm.title=Confirmation