From 4bc0a2da060f8e79ca97daf58b2323b34feda67b Mon Sep 17 00:00:00 2001 From: anhefti Date: Tue, 7 Feb 2023 17:20:11 +0100 Subject: [PATCH] SEBSERV-376 finished up --- .../gbl/model/session/ClientConnection.java | 18 ++++++++++++------ .../session/ClientConnectionDetails.java | 14 ++++++++++++-- src/main/resources/messages.properties | 3 ++- .../admin/ExamProctoringRoomServiceTest.java | 3 +++ .../SEBClientInstructionServiceTest.java | 2 ++ 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java index 2bc1d97a..f7117b1d 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java @@ -115,7 +115,8 @@ public final class ClientConnection implements GrantEntity { //@JsonProperty(Domain.CLIENT_CONNECTION.ATTR_VDI_PAIR_TOKEN) public final String vdiPairToken; - @JsonIgnore + //@JsonIgnore + @JsonProperty(Domain.CLIENT_CONNECTION.ATTR_CLIENT_ADDRESS) public final String clientAddress; @JsonIgnore public final Long remoteProctoringRoomId; @@ -127,11 +128,13 @@ public final class ClientConnection implements GrantEntity { public final Long updateTime; @JsonIgnore public final Boolean remoteProctoringRoomUpdate; - @JsonIgnore + //@JsonIgnore + @JsonProperty(Domain.CLIENT_CONNECTION.ATTR_CLIENT_OS_NAME) public final String sebOSName; @JsonIgnore public final String sebMachineName; - @JsonIgnore + //@JsonIgnore + @JsonProperty(Domain.CLIENT_CONNECTION.ATTR_CLIENT_VERSION) public final String sebVersion; @JsonIgnore public final String ask; @@ -148,6 +151,9 @@ public final class ClientConnection implements GrantEntity { @JsonProperty(Domain.CLIENT_CONNECTION.ATTR_VDI) final Boolean vdi, @JsonProperty(Domain.CLIENT_CONNECTION.ATTR_VDI_PAIR_TOKEN) final String vdiPairToken, @JsonProperty(Domain.CLIENT_CONNECTION.ATTR_REMOTE_PROCTORING_ROOM_ID) final Long remoteProctoringRoomId, + @JsonProperty(Domain.CLIENT_CONNECTION.ATTR_CLIENT_ADDRESS) final String clientAddress, + @JsonProperty(Domain.CLIENT_CONNECTION.ATTR_CLIENT_OS_NAME) final String sebOSName, + @JsonProperty(Domain.CLIENT_CONNECTION.ATTR_CLIENT_VERSION) final String sebVersion, @JsonProperty(Domain.CLIENT_CONNECTION.ATTR_SECURITY_CHECK_GRANTED) final Boolean securityCheckGranted, @JsonProperty(Domain.CLIENT_CONNECTION.ATTR_CLIENT_VERSION_GRANTED) final Boolean clientVersionGranted) { @@ -166,10 +172,10 @@ public final class ClientConnection implements GrantEntity { this.remoteProctoringRoomId = remoteProctoringRoomId; this.remoteProctoringRoomUpdate = false; - this.clientAddress = Constants.EMPTY_NOTE; - this.sebOSName = Constants.EMPTY_NOTE; + this.clientAddress = clientAddress; + this.sebOSName = sebOSName; this.sebMachineName = Constants.EMPTY_NOTE; - this.sebVersion = Constants.EMPTY_NOTE; + this.sebVersion = sebVersion; this.securityCheckGranted = securityCheckGranted; this.ask = null; this.clientVersionGranted = clientVersionGranted; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionDetails.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionDetails.java index 87719e08..aa97b2c6 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionDetails.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionDetails.java @@ -32,6 +32,7 @@ import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection.ConnectionStatus import ch.ethz.seb.sebserver.gbl.model.session.ClientConnectionData; import ch.ethz.seb.sebserver.gbl.model.session.ClientNotification; import ch.ethz.seb.sebserver.gbl.monitoring.IndicatorValue; +import ch.ethz.seb.sebserver.gbl.util.Utils; import ch.ethz.seb.sebserver.gui.content.action.ActionDefinition; import ch.ethz.seb.sebserver.gui.form.Form; import ch.ethz.seb.sebserver.gui.form.FormBuilder; @@ -132,7 +133,8 @@ public class ClientConnectionDetails implements MonitoringEntry { .addField(FormBuilder.text( ClientConnection.ATTR_INFO, CONNECTION_INFO_TEXT_KEY, - Constants.EMPTY_NOTE)) + Constants.EMPTY_NOTE) + .asArea(50)) .withDefaultSpanInput(3) .addField(FormBuilder.text( Domain.CLIENT_CONNECTION.ATTR_STATUS, @@ -251,7 +253,7 @@ public class ClientConnectionDetails implements MonitoringEntry { form.setFieldValue( ClientConnection.ATTR_INFO, - this.connectionData.clientConnection.info); + getConnectionInfo(this.connectionData.clientConnection)); if (this.hasClientGroups && Constants.EMPTY_NOTE.equals(form.getFieldValue(ClientConnectionData.ATTR_CLIENT_GROUPS))) { @@ -317,6 +319,14 @@ public class ClientConnectionDetails implements MonitoringEntry { } } + private String getConnectionInfo(final ClientConnection clientConnection) { + return Utils.formatLineBreaks(this.pageService.getI18nSupport().getText( + "sebserver.monitoring.exam.connection.info", "--", + clientConnection.getSebVersion(), + clientConnection.getSebOSName(), + clientConnection.clientAddress)); + } + private void reloadPage(final PageContext pageContext) { final PageAction pageReloadAction = this.pageService.pageActionBuilder(pageContext) .newAction(ActionDefinition.MONITOR_EXAM_CLIENT_CONNECTION) diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index 89a32893..73c2c998 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -2218,7 +2218,8 @@ 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.SEB_VERSION_DENIED=SEB Version Invalid + +sebserver.monitoring.exam.connection.info=SEB Version: {0}
Operating System: {1}
IP Address: {2} sebserver.monitoring.lock.title=Lock SEB Clients sebserver.monitoring.lock.form.info.title=Info diff --git a/src/test/java/ch/ethz/seb/sebserver/webservice/integration/api/admin/ExamProctoringRoomServiceTest.java b/src/test/java/ch/ethz/seb/sebserver/webservice/integration/api/admin/ExamProctoringRoomServiceTest.java index 7f733dd0..7467cf67 100644 --- a/src/test/java/ch/ethz/seb/sebserver/webservice/integration/api/admin/ExamProctoringRoomServiceTest.java +++ b/src/test/java/ch/ethz/seb/sebserver/webservice/integration/api/admin/ExamProctoringRoomServiceTest.java @@ -99,6 +99,9 @@ public class ExamProctoringRoomServiceTest extends AdministrationAPIIntegrationT false, "", null, + "", + null, + null, false, false)); assertFalse(createNew.hasError()); } diff --git a/src/test/java/ch/ethz/seb/sebserver/webservice/integration/services/SEBClientInstructionServiceTest.java b/src/test/java/ch/ethz/seb/sebserver/webservice/integration/services/SEBClientInstructionServiceTest.java index 737add5f..54d96275 100644 --- a/src/test/java/ch/ethz/seb/sebserver/webservice/integration/services/SEBClientInstructionServiceTest.java +++ b/src/test/java/ch/ethz/seb/sebserver/webservice/integration/services/SEBClientInstructionServiceTest.java @@ -47,6 +47,8 @@ public class SEBClientInstructionServiceTest extends AdministrationAPIIntegratio if (cc == null) { this.clientConnectionDAO.createNew(new ClientConnection( null, 1L, 2L, ConnectionStatus.ACTIVE, "testToken", "user1", "0.0.0.0", false, null, null, + "0.0.0.0", + null, null, false, false)) .getOrThrow(); }