From d35fbed73da3915147f642f522cc58c81498edd6 Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 9 Mar 2023 10:31:09 +0100 Subject: [PATCH] SEBSERV-391 and SEBSERV-397 and SEBSERV-335 --- .../gui/service/ResourceService.java | 2 +- .../session/ClientConnectionTable.java | 27 ++++++++++--------- .../dao/impl/ClientConnectionDAOImpl.java | 2 +- .../impl/SecurityKeyServiceImpl.java | 11 -------- src/main/resources/messages.properties | 4 +-- 5 files changed, 19 insertions(+), 27 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/ResourceService.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/ResourceService.java index 75befe64..ebd24a05 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/ResourceService.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/ResourceService.java @@ -654,7 +654,7 @@ public class ResourceService { return localizedNames.get(status) + grantMissingText; } } else if (monitoringEntry.grantDenied()) { - return grantDeniedText; + return localizedNames.get(status) + grantDeniedText; } } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java index f451ad7e..e6f9bbf1 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java @@ -577,6 +577,17 @@ public final class ClientConnectionTable implements FullPageMonitoringGUIUpdate tableItem.setForeground(index, statusTextColor); } + private void updateIndicatorValues(final TableItem tableItem) { + if (this.monitoringData == null || this.indicatorWeights == null) { + return; + } + + this.monitoringData.indicatorVals + .entrySet() + .stream() + .forEach(indicatorUpdate(tableItem)); + } + private Consumer> indicatorUpdate(final TableItem tableItem) { return entry -> { final Long id = entry.getKey(); @@ -608,17 +619,6 @@ public final class ClientConnectionTable implements FullPageMonitoringGUIUpdate }; } - private void updateIndicatorValues(final TableItem tableItem) { - if (this.monitoringData == null || this.indicatorWeights == null) { - return; - } - - this.monitoringData.indicatorVals - .entrySet() - .stream() - .forEach(indicatorUpdate(tableItem)); - } - @Override public int compareTo(final UpdatableTableItem other) { return Comparator.comparingInt(UpdatableTableItem::notificationWeight) @@ -709,6 +709,9 @@ public final class ClientConnectionTable implements FullPageMonitoringGUIUpdate if (this.indicatorWeights == null) { this.indicatorWeights = new int[ClientConnectionTable.this.indicatorMapping.size()]; + for (int i = 0; i < this.indicatorWeights.length; i++) { + this.indicatorWeights[i] = -1; + } } if (this.indicatorValueChanged) { updateIndicatorWeight(); @@ -743,6 +746,7 @@ public final class ClientConnectionTable implements FullPageMonitoringGUIUpdate final int indicatorWeight = IndicatorData.getWeight( indicatorData, IndicatorValue.getFromDisplayValue(displayValue)); + if (this.indicatorWeights[indicatorData.index] != indicatorWeight) { ClientConnectionTable.this.needsSort = true; this.thresholdsWeight -= (indicatorData.indicator.type.inverse) @@ -761,7 +765,6 @@ public final class ClientConnectionTable implements FullPageMonitoringGUIUpdate private ClientConnectionTable getOuterType() { return ClientConnectionTable.this; } - } private void fetchStaticClientConnectionData() { diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientConnectionDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientConnectionDAOImpl.java index bc4011a6..27406d9c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientConnectionDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientConnectionDAOImpl.java @@ -799,7 +799,7 @@ public class ClientConnectionDAOImpl implements ClientConnectionDAO { SqlBuilder.isEqualTo(examId)) .and( ClientConnectionRecordDynamicSqlSupport.status, - SqlBuilder.isIn(ClientConnection.SECURE_STATES)) + SqlBuilder.isIn(ClientConnection.SECURE_CHECK_STATES)) .and( ClientConnectionRecordDynamicSqlSupport.ask, SqlBuilder.isEqualTo(signatureHash)) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/institution/impl/SecurityKeyServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/institution/impl/SecurityKeyServiceImpl.java index bc486505..f1c2889f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/institution/impl/SecurityKeyServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/institution/impl/SecurityKeyServiceImpl.java @@ -179,17 +179,6 @@ public class SecurityKeyServiceImpl implements SecurityKeyService { return Cryptor .decryptASK(appSignatureKey, connectionToken, salt) -// .decrypt(appSignatureKey + salt, connectionToken) -// .onErrorDo(error -> { -// -// log.warn( -// "Failed to decrypt ASK with added salt value. Try to decrypt without added salt. Error: {}", -// error.getMessage()); -// -// return Cryptor -// .decrypt(appSignatureKey, connectionToken) -// .getOrThrow(); -// }) .map(signature -> createSignatureHash(signature)); } diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index f02b081a..918126a7 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -2223,7 +2223,7 @@ sebserver.monitoring.exam.connection.notification.type.RAISE_HAND=Raise Hand sebserver.monitoring.exam.connection.notificationlist.type=Notification Type sebserver.monitoring.exam.connection.status.UNDEFINED=Undefined -sebserver.monitoring.exam.connection.status.CONNECTION_REQUESTED=Connection Requested +sebserver.monitoring.exam.connection.status.CONNECTION_REQUESTED=Connecting sebserver.monitoring.exam.connection.status.AUTHENTICATED=Authenticated sebserver.monitoring.exam.connection.status.ACTIVE=Active sebserver.monitoring.exam.connection.status.CLOSED=Closed @@ -2231,7 +2231,7 @@ sebserver.monitoring.exam.connection.status.ABORTED=Aborted sebserver.monitoring.exam.connection.status.DISABLED=Canceled sebserver.monitoring.exam.connection.status.MISSING_PING=Missing sebserver.monitoring.exam.connection.status.MISSING_GRANT=  (No ASK Grant) -sebserver.monitoring.exam.connection.status.GRANT_DENIED=ASK Grant Denied +sebserver.monitoring.exam.connection.status.GRANT_DENIED= - ASK Grant Denied sebserver.monitoring.exam.connection.info=SEB Version: {0}
Operating System: {1}
IP Address: {2}