fixed session id, exam delete, ane better logs
This commit is contained in:
parent
349303c168
commit
70358d0128
7 changed files with 56 additions and 10 deletions
|
@ -26,16 +26,20 @@ import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API.BulkActionType;
|
import ch.ethz.seb.sebserver.gbl.api.API.BulkActionType;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.APIMessage;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.APIMessage.ErrorMessage;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityDependency;
|
import ch.ethz.seb.sebserver.gbl.model.EntityDependency;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.exam.Exam;
|
import ch.ethz.seb.sebserver.gbl.model.exam.Exam;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.util.Result;
|
||||||
import ch.ethz.seb.sebserver.gbl.util.Utils;
|
import ch.ethz.seb.sebserver.gbl.util.Utils;
|
||||||
import ch.ethz.seb.sebserver.gui.content.action.ActionDefinition;
|
import ch.ethz.seb.sebserver.gui.content.action.ActionDefinition;
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
|
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.PageContext;
|
import ch.ethz.seb.sebserver.gui.service.page.PageContext;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.page.PageMessageException;
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.PageService;
|
import ch.ethz.seb.sebserver.gui.service.page.PageService;
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.event.ActionEvent;
|
import ch.ethz.seb.sebserver.gui.service.page.event.ActionEvent;
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.impl.ModalInputWizard;
|
import ch.ethz.seb.sebserver.gui.service.page.impl.ModalInputWizard;
|
||||||
|
@ -43,6 +47,7 @@ import ch.ethz.seb.sebserver.gui.service.page.impl.ModalInputWizard.WizardAction
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.impl.ModalInputWizard.WizardPage;
|
import ch.ethz.seb.sebserver.gui.service.page.impl.ModalInputWizard.WizardPage;
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.impl.PageAction;
|
import ch.ethz.seb.sebserver.gui.service.page.impl.PageAction;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCallError;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.DeleteExam;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.DeleteExam;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetExam;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetExam;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetExamDependencies;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetExamDependencies;
|
||||||
|
@ -76,6 +81,8 @@ public class ExamDeletePopup {
|
||||||
|
|
||||||
private final static LocTextKey DELETE_CONFIRM_TITLE =
|
private final static LocTextKey DELETE_CONFIRM_TITLE =
|
||||||
new LocTextKey("sebserver.exam.delete.confirm.title");
|
new LocTextKey("sebserver.exam.delete.confirm.title");
|
||||||
|
private final static LocTextKey DELETE_ERROR_CONSISTENCY =
|
||||||
|
new LocTextKey("sebserver.exam.action.delete.consistency.error");
|
||||||
|
|
||||||
private final PageService pageService;
|
private final PageService pageService;
|
||||||
|
|
||||||
|
@ -126,7 +133,23 @@ public class ExamDeletePopup {
|
||||||
.withURIVariable(API.PARAM_MODEL_ID, entityKey.modelId)
|
.withURIVariable(API.PARAM_MODEL_ID, entityKey.modelId)
|
||||||
.withQueryParam(API.PARAM_BULK_ACTION_TYPE, BulkActionType.HARD_DELETE.name());
|
.withQueryParam(API.PARAM_BULK_ACTION_TYPE, BulkActionType.HARD_DELETE.name());
|
||||||
|
|
||||||
final EntityProcessingReport report = restCallBuilder.call().getOrThrow();
|
final Result<EntityProcessingReport> deleteCall = restCallBuilder.call();
|
||||||
|
if (deleteCall.hasError()) {
|
||||||
|
final Exception error = deleteCall.getError();
|
||||||
|
if (error instanceof RestCallError) {
|
||||||
|
final APIMessage message = ((RestCallError) error)
|
||||||
|
.getAPIMessages()
|
||||||
|
.stream()
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if (message != null && ErrorMessage.INTEGRITY_VALIDATION.isOf(message)) {
|
||||||
|
pageContext.publishPageMessage(new PageMessageException(DELETE_ERROR_CONSISTENCY));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final EntityProcessingReport report = deleteCall.getOrThrow();
|
||||||
|
|
||||||
final PageAction action = this.pageService.pageActionBuilder(pageContext)
|
final PageAction action = this.pageService.pageActionBuilder(pageContext)
|
||||||
.newAction(ActionDefinition.EXAM_VIEW_LIST)
|
.newAction(ActionDefinition.EXAM_VIEW_LIST)
|
||||||
|
|
|
@ -293,8 +293,13 @@ public final class ClientConnectionTable {
|
||||||
final Set<EntityKey> result = new HashSet<>();
|
final Set<EntityKey> result = new HashSet<>();
|
||||||
for (int i = 0; i < selectionIndices.length; i++) {
|
for (int i = 0; i < selectionIndices.length; i++) {
|
||||||
final UpdatableTableItem updatableTableItem =
|
final UpdatableTableItem updatableTableItem =
|
||||||
new ArrayList<>(this.tableMapping.values()).get(selectionIndices[0]);
|
new ArrayList<>(this.tableMapping.values())
|
||||||
result.add(new EntityKey(updatableTableItem.connectionId, EntityType.CLIENT_CONNECTION));
|
.stream()
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if (updatableTableItem != null) {
|
||||||
|
result.add(new EntityKey(updatableTableItem.connectionId, EntityType.CLIENT_CONNECTION));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,8 +165,8 @@ public class BulkActionServiceImpl implements BulkActionService {
|
||||||
final Exception error = bulkActionSingleResult.getError();
|
final Exception error = bulkActionSingleResult.getError();
|
||||||
|
|
||||||
log.error(
|
log.error(
|
||||||
"Unexpected error on bulk action processing. This error is reported to the caller: {}",
|
"Unexpected error on bulk action processing. This error is reported to the caller: ",
|
||||||
error.getMessage());
|
error);
|
||||||
|
|
||||||
if (error instanceof BulkActionEntityException) {
|
if (error instanceof BulkActionEntityException) {
|
||||||
return new ErrorEntry(
|
return new ErrorEntry(
|
||||||
|
|
|
@ -675,11 +675,16 @@ public class SEBClientConnectionServiceImpl implements SEBClientConnectionServic
|
||||||
|
|
||||||
if (StringUtils.isNoneBlank(userSessionId)) {
|
if (StringUtils.isNoneBlank(userSessionId)) {
|
||||||
if (StringUtils.isNoneBlank(clientConnection.userSessionId)) {
|
if (StringUtils.isNoneBlank(clientConnection.userSessionId)) {
|
||||||
log.error(
|
if (clientConnection.userSessionId.contains(userSessionId)) {
|
||||||
"ClientConnection integrity violation: clientConnection has already a userSessionId: {} : {}",
|
if (log.isDebugEnabled()) {
|
||||||
userSessionId, clientConnection);
|
log.debug("SEB sent LMS userSessionId but clientConnection has already a userSessionId");
|
||||||
throw new IllegalArgumentException(
|
}
|
||||||
"ClientConnection integrity violation: clientConnection has already a userSessionId");
|
} else {
|
||||||
|
log.warn(
|
||||||
|
"Possible client integrity violation: clientConnection has already a userSessionId: {} : {}",
|
||||||
|
userSessionId, clientConnection.userSessionId);
|
||||||
|
}
|
||||||
|
return clientConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to get user account display name
|
// try to get user account display name
|
||||||
|
|
|
@ -372,6 +372,13 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
|
||||||
|
|
||||||
final EntityType entityType = this.entityDAO.entityType();
|
final EntityType entityType = this.entityDAO.entityType();
|
||||||
final Collection<EntityKey> sources = ids.stream()
|
final Collection<EntityKey> sources = ids.stream()
|
||||||
|
.map(id -> {
|
||||||
|
return this.entityDAO.byModelId(id)
|
||||||
|
.flatMap(exam -> this.validForDelete(exam))
|
||||||
|
.getOr(null);
|
||||||
|
})
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(exam -> exam.getModelId())
|
||||||
.map(id -> new EntityKey(id, entityType))
|
.map(id -> new EntityKey(id, entityType))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
|
@ -495,6 +495,11 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Result<Exam> validForDelete(final Exam entity) {
|
||||||
|
return checkNoActiveSEBClientConnections(entity);
|
||||||
|
}
|
||||||
|
|
||||||
private Exam checkExamSupporterRole(final Exam exam) {
|
private Exam checkExamSupporterRole(final Exam exam) {
|
||||||
final Set<String> examSupporter = this.userDAO.all(
|
final Set<String> examSupporter = this.userDAO.all(
|
||||||
this.authorization.getUserService().getCurrentUser().getUserInfo().institutionId,
|
this.authorization.getUserService().getCurrentUser().getUserInfo().institutionId,
|
||||||
|
|
|
@ -451,6 +451,7 @@ sebserver.exam.action.save=Save Exam
|
||||||
sebserver.exam.action.activate=Activate Exam
|
sebserver.exam.action.activate=Activate Exam
|
||||||
sebserver.exam.action.deactivate=Deactivate Exam
|
sebserver.exam.action.deactivate=Deactivate Exam
|
||||||
sebserver.exam.action.delete=Delete Exam
|
sebserver.exam.action.delete=Delete Exam
|
||||||
|
sebserver.exam.action.delete.consistency.error=Deletion Failed.<br/>Please make sure there are no active SEB clients connected to the exam before deletion.
|
||||||
sebserver.exam.action.sebrestriction.enable=Apply SEB Lock
|
sebserver.exam.action.sebrestriction.enable=Apply SEB Lock
|
||||||
sebserver.exam.action.sebrestriction.disable=Release SEB Lock
|
sebserver.exam.action.sebrestriction.disable=Release SEB Lock
|
||||||
sebserver.exam.action.sebrestriction.details=SEB Restriction Details
|
sebserver.exam.action.sebrestriction.details=SEB Restriction Details
|
||||||
|
|
Loading…
Add table
Reference in a new issue