SEBSERV-137 fixed -->
"Connection requested" shall be considered as active SEB Client
This commit is contained in:
parent
e42336aa6a
commit
fe45a0357c
7 changed files with 11 additions and 21 deletions
|
@ -34,12 +34,12 @@ public final class ClientConnection implements GrantEntity {
|
||||||
|
|
||||||
public final boolean connectingStatus;
|
public final boolean connectingStatus;
|
||||||
public final boolean establishedStatus;
|
public final boolean establishedStatus;
|
||||||
public final boolean indicatorActiveStatus;
|
public final boolean clientActiveStatus;
|
||||||
|
|
||||||
ConnectionStatus(final boolean connectingStatus, final boolean establishedStatus) {
|
ConnectionStatus(final boolean connectingStatus, final boolean establishedStatus) {
|
||||||
this.connectingStatus = connectingStatus;
|
this.connectingStatus = connectingStatus;
|
||||||
this.establishedStatus = establishedStatus;
|
this.establishedStatus = establishedStatus;
|
||||||
this.indicatorActiveStatus = connectingStatus || establishedStatus;
|
this.clientActiveStatus = connectingStatus || establishedStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,7 +369,7 @@ public class MonitoringClientConnection implements TemplateComposer {
|
||||||
})
|
})
|
||||||
.noEventPropagation()
|
.noEventPropagation()
|
||||||
.publishIf(() -> currentUser.get().hasRole(UserRole.EXAM_SUPPORTER) &&
|
.publishIf(() -> currentUser.get().hasRole(UserRole.EXAM_SUPPORTER) &&
|
||||||
connectionData.clientConnection.status.indicatorActiveStatus);
|
connectionData.clientConnection.status.clientActiveStatus);
|
||||||
|
|
||||||
if (connectionData.clientConnection.status == ConnectionStatus.ACTIVE) {
|
if (connectionData.clientConnection.status == ConnectionStatus.ACTIVE) {
|
||||||
final ProctoringServiceSettings proctoringSettings = restService
|
final ProctoringServiceSettings proctoringSettings = restService
|
||||||
|
|
|
@ -436,7 +436,7 @@ public class MonitoringRunningExam implements TemplateComposer {
|
||||||
|
|
||||||
private Set<EntityKey> selectionForQuitInstruction(final ClientConnectionTable clientTable) {
|
private Set<EntityKey> selectionForQuitInstruction(final ClientConnectionTable clientTable) {
|
||||||
final Set<String> connectionTokens = clientTable.getConnectionTokens(
|
final Set<String> connectionTokens = clientTable.getConnectionTokens(
|
||||||
cc -> cc.status.indicatorActiveStatus,
|
cc -> cc.status.clientActiveStatus,
|
||||||
true);
|
true);
|
||||||
if (connectionTokens == null || connectionTokens.isEmpty()) {
|
if (connectionTokens == null || connectionTokens.isEmpty()) {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class ClientConnectionDetails {
|
||||||
final double value = indValue.getValue();
|
final double value = indValue.getValue();
|
||||||
final String displayValue = IndicatorValue.getDisplayValue(indValue);
|
final String displayValue = IndicatorValue.getDisplayValue(indValue);
|
||||||
|
|
||||||
if (!this.connectionData.clientConnection.status.indicatorActiveStatus) {
|
if (!this.connectionData.clientConnection.status.clientActiveStatus) {
|
||||||
|
|
||||||
form.setFieldValue(
|
form.setFieldValue(
|
||||||
indData.indicator.name,
|
indData.indicator.name,
|
||||||
|
|
|
@ -597,7 +597,7 @@ public final class ClientConnectionTable {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.connectionData.clientConnection.status.indicatorActiveStatus) {
|
if (!this.connectionData.clientConnection.status.clientActiveStatus) {
|
||||||
final String value = (indicatorData.indicator.type.showOnlyInActiveState)
|
final String value = (indicatorData.indicator.type.showOnlyInActiveState)
|
||||||
? Constants.EMPTY_NOTE
|
? Constants.EMPTY_NOTE
|
||||||
: IndicatorValue.getDisplayValue(indicatorValue);
|
: IndicatorValue.getDisplayValue(indicatorValue);
|
||||||
|
|
|
@ -86,6 +86,10 @@ public class WebserviceInit implements ApplicationListener<ApplicationReadyEvent
|
||||||
SEBServerInit.INIT_LOGGER.info("---->");
|
SEBServerInit.INIT_LOGGER.info("---->");
|
||||||
SEBServerInit.INIT_LOGGER.info("----> *** Info:");
|
SEBServerInit.INIT_LOGGER.info("----> *** Info:");
|
||||||
|
|
||||||
|
if (this.webserviceInfo.isDistributed()) {
|
||||||
|
SEBServerInit.INIT_LOGGER.info("----> Distributed Setup: {}", this.webserviceInfo.getWebserviceUUID());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SEBServerInit.INIT_LOGGER.info("----> Server address: {}", this.environment.getProperty("server.address"));
|
SEBServerInit.INIT_LOGGER.info("----> Server address: {}", this.environment.getProperty("server.address"));
|
||||||
SEBServerInit.INIT_LOGGER.info("----> Server port: {}", this.environment.getProperty("server.port"));
|
SEBServerInit.INIT_LOGGER.info("----> Server port: {}", this.environment.getProperty("server.port"));
|
||||||
|
|
|
@ -14,14 +14,12 @@ import java.util.function.Predicate;
|
||||||
|
|
||||||
import org.springframework.cache.CacheManager;
|
import org.springframework.cache.CacheManager;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.Constants;
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.APIMessage;
|
import ch.ethz.seb.sebserver.gbl.api.APIMessage;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.exam.Exam;
|
import ch.ethz.seb.sebserver.gbl.model.exam.Exam;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection;
|
import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection.ConnectionStatus;
|
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.ClientConnectionData;
|
||||||
import ch.ethz.seb.sebserver.gbl.util.Result;
|
import ch.ethz.seb.sebserver.gbl.util.Result;
|
||||||
import ch.ethz.seb.sebserver.gbl.util.Utils;
|
|
||||||
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ClientConnectionDAO;
|
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ClientConnectionDAO;
|
||||||
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ExamDAO;
|
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ExamDAO;
|
||||||
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap;
|
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap;
|
||||||
|
@ -185,19 +183,7 @@ public interface ExamSessionService {
|
||||||
* @param connection ClientConnectionData instance
|
* @param connection ClientConnectionData instance
|
||||||
* @return true if the given ClientConnectionData is an active SEB client connection */
|
* @return true if the given ClientConnectionData is an active SEB client connection */
|
||||||
static boolean isActiveConnection(final ClientConnectionData connection) {
|
static boolean isActiveConnection(final ClientConnectionData connection) {
|
||||||
if (connection.clientConnection.status.establishedStatus) {
|
return connection.clientConnection.status.clientActiveStatus;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (connection.clientConnection.status == ConnectionStatus.CONNECTION_REQUESTED) {
|
|
||||||
final Long creationTime = connection.clientConnection.getCreationTime();
|
|
||||||
final long millisecondsNow = Utils.getMillisecondsNow();
|
|
||||||
if (millisecondsNow - creationTime < 30 * Constants.SECOND_IN_MILLIS) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue