Merge branch 'dev-2.0' of github.com:SafeExamBrowser/seb-server into docu
This commit is contained in:
commit
7f7ac3e378
8 changed files with 37 additions and 7 deletions
|
@ -363,7 +363,7 @@ public final class Exam implements GrantEntity {
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public boolean isLmsAvailable() {
|
public boolean isLmsAvailable() {
|
||||||
return BooleanUtils.isTrue(this.lmsAvailable);
|
return BooleanUtils.isNotFalse(this.lmsAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExternalId() {
|
public String getExternalId() {
|
||||||
|
|
|
@ -336,7 +336,7 @@ public class ExamList implements TemplateComposer {
|
||||||
final Exam exam,
|
final Exam exam,
|
||||||
final PageService pageService) {
|
final PageService pageService) {
|
||||||
|
|
||||||
if (BooleanUtils.isFalse(exam.isLmsAvailable())) {
|
if (exam.lmsSetupId != null && BooleanUtils.isFalse(exam.isLmsAvailable())) {
|
||||||
item.setData(RWT.CUSTOM_VARIANT, CustomVariant.DISABLED.key);
|
item.setData(RWT.CUSTOM_VARIANT, CustomVariant.DISABLED.key);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import ch.ethz.seb.sebserver.gbl.model.user.UserRole;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -29,6 +30,7 @@ import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.*;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
@ -348,6 +350,12 @@ public class MonitoringProctoringService {
|
||||||
httpEntity,
|
httpEntity,
|
||||||
String.class);
|
String.class);
|
||||||
|
|
||||||
|
if (tokenRequest.getStatusCode() == HttpStatus.UNAUTHORIZED &&
|
||||||
|
currentUser.get().hasAnyRole(UserRole.EXAM_SUPPORTER, UserRole.INSTITUTIONAL_ADMIN)) {
|
||||||
|
notifyUnauthorized(_action, currentUser);
|
||||||
|
return _action;
|
||||||
|
}
|
||||||
|
|
||||||
// Open SPS Gui redirect URL with login token (jwt token) in new browser tab
|
// Open SPS Gui redirect URL with login token (jwt token) in new browser tab
|
||||||
final String redirectLocation = redirect.getBody() + "/jwt?token=" + tokenRequest.getBody();
|
final String redirectLocation = redirect.getBody() + "/jwt?token=" + tokenRequest.getBody();
|
||||||
// final String script = "var win = window.open('', 'seb_screen_proctoring'); win.location.href = '"+ redirectLocation + "';";
|
// final String script = "var win = window.open('', 'seb_screen_proctoring'); win.location.href = '"+ redirectLocation + "';";
|
||||||
|
@ -357,13 +365,28 @@ public class MonitoringProctoringService {
|
||||||
// .getService(JavaScriptExecutor.class)
|
// .getService(JavaScriptExecutor.class)
|
||||||
// .execute(script);
|
// .execute(script);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
if (e instanceof HttpClientErrorException) {
|
||||||
|
if (((HttpClientErrorException) e).getRawStatusCode() == HttpStatus.UNAUTHORIZED.value()) {
|
||||||
|
notifyUnauthorized(_action, this.pageService.getCurrentUser());
|
||||||
|
return _action;
|
||||||
|
}
|
||||||
|
}
|
||||||
log.error("Failed to open screen proctoring service group gallery view: ", e);
|
log.error("Failed to open screen proctoring service group gallery view: ", e);
|
||||||
_action.pageContext()
|
_action.pageContext()
|
||||||
.notifyError(new LocTextKey("Failed to open screen proctoring service group gallery view"), e);
|
.notifyError(new LocTextKey("sebserver.monitoring.sps.opengallery.fail"), e);
|
||||||
}
|
}
|
||||||
return _action;
|
return _action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void notifyUnauthorized(final PageAction _action, final CurrentUser currentUser) {
|
||||||
|
log.warn("No Access to Screen Proctoring for user: {}", currentUser.get().username);
|
||||||
|
_action
|
||||||
|
.pageContext()
|
||||||
|
.notifyError(
|
||||||
|
new LocTextKey("sebserver.monitoring.sps.noaccess"),
|
||||||
|
new RuntimeException("No access to Screen Proctoring. Please make sure you are assigned as Exam Supporter for this exam."));
|
||||||
|
}
|
||||||
|
|
||||||
private PageAction openExamProctoringRoom(
|
private PageAction openExamProctoringRoom(
|
||||||
final ProctoringGUIService proctoringGUIService,
|
final ProctoringGUIService proctoringGUIService,
|
||||||
final ProctoringServiceSettings proctoringSettings,
|
final ProctoringServiceSettings proctoringSettings,
|
||||||
|
|
|
@ -101,6 +101,9 @@ public class LmsTestServiceImpl implements LmsTestService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private LmsSetupTestResult fullIntegrationTest(final LmsAPITemplate template) {
|
private LmsSetupTestResult fullIntegrationTest(final LmsAPITemplate template) {
|
||||||
|
if (template.lmsSetup().lmsType != LmsSetup.LmsType.MOODLE_PLUGIN) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (!template.fullIntegrationActive()) {
|
if (!template.fullIntegrationActive()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ public interface ScreenProctoringService extends SessionUpdateTask {
|
||||||
void updateClientConnections();
|
void updateClientConnections();
|
||||||
|
|
||||||
/** This goes through all running exams with screen proctoring enabled and updates the group attributes
|
/** This goes through all running exams with screen proctoring enabled and updates the group attributes
|
||||||
* (mainly the number of active clients in the group) by call ing SPS API and store newest data. */
|
* (mainly the number of active clients in the group) by calling SPS API and store newest data. */
|
||||||
void updateActiveGroups();
|
void updateActiveGroups();
|
||||||
|
|
||||||
@Async(AsyncServiceSpringConfig.EXECUTOR_BEAN_NAME)
|
@Async(AsyncServiceSpringConfig.EXECUTOR_BEAN_NAME)
|
||||||
|
|
|
@ -146,7 +146,7 @@ class ExamUpdateHandler implements ExamUpdateTask {
|
||||||
.forEach(quizId -> {
|
.forEach(quizId -> {
|
||||||
try {
|
try {
|
||||||
final Exam exam = exams.get(quizId);
|
final Exam exam = exams.get(quizId);
|
||||||
if (exam.lmsAvailable == null || exam.isLmsAvailable()) {
|
if (exam.lmsSetupId != null && (exam.lmsAvailable == null || exam.isLmsAvailable())) {
|
||||||
this.examDAO.markLMSAvailability(quizId, false, updateId);
|
this.examDAO.markLMSAvailability(quizId, false, updateId);
|
||||||
}
|
}
|
||||||
} catch (final Exception ee) {
|
} catch (final Exception ee) {
|
||||||
|
|
|
@ -577,6 +577,7 @@ public class ScreenProctoringServiceImpl implements ScreenProctoringService {
|
||||||
log.debug("Register JOIN instruction for client ");
|
log.debug("Register JOIN instruction for client ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final boolean checkActive = exam.lmsSetupId != null;
|
||||||
final SPSData spsData = this.screenProctoringAPIBinding.getSPSData(exam.id);
|
final SPSData spsData = this.screenProctoringAPIBinding.getSPSData(exam.id);
|
||||||
final String url = screenProctoringServiceBundle.bundled
|
final String url = screenProctoringServiceBundle.bundled
|
||||||
? screenProctoringServiceBundle.serviceURL
|
? screenProctoringServiceBundle.serviceURL
|
||||||
|
@ -597,7 +598,7 @@ public class ScreenProctoringServiceImpl implements ScreenProctoringService {
|
||||||
InstructionType.SEB_PROCTORING,
|
InstructionType.SEB_PROCTORING,
|
||||||
attributes,
|
attributes,
|
||||||
ccRecord.getConnectionToken(),
|
ccRecord.getConnectionToken(),
|
||||||
true,
|
checkActive,
|
||||||
true)
|
true)
|
||||||
.onError(error -> log.error(
|
.onError(error -> log.error(
|
||||||
"Failed to register screen proctoring join instruction for SEB connection: {}",
|
"Failed to register screen proctoring join instruction for SEB connection: {}",
|
||||||
|
|
|
@ -1039,7 +1039,7 @@ sebserver.clientconfig.form.sebServerFallbackPasswordHash=Fallback Password
|
||||||
sebserver.clientconfig.form.sebServerFallbackPasswordHash.tooltip=A password if set a SEB Client user must provide before SEB starts the fallback procedure
|
sebserver.clientconfig.form.sebServerFallbackPasswordHash.tooltip=A password if set a SEB Client user must provide before SEB starts the fallback procedure
|
||||||
sebserver.clientconfig.form.sebServerFallbackPasswordHash.confirm=Confirm Password
|
sebserver.clientconfig.form.sebServerFallbackPasswordHash.confirm=Confirm Password
|
||||||
sebserver.clientconfig.form.sebServerFallbackPasswordHash.tooltip.confirm=Please confirm the fallback password
|
sebserver.clientconfig.form.sebServerFallbackPasswordHash.tooltip.confirm=Please confirm the fallback password
|
||||||
|
sebserver.clientconfig.form.hashedQuitPassword=Quit Password
|
||||||
sebserver.clientconfig.form.hashedQuitPassword.tooltip=A password if set a SEB user must provide to be able to quit SEB
|
sebserver.clientconfig.form.hashedQuitPassword.tooltip=A password if set a SEB user must provide to be able to quit SEB
|
||||||
sebserver.clientconfig.form.hashedQuitPassword.confirm=Confirm Password
|
sebserver.clientconfig.form.hashedQuitPassword.confirm=Confirm Password
|
||||||
sebserver.clientconfig.form.hashedQuitPassword.tooltip.confirm=Please confirm the quit password
|
sebserver.clientconfig.form.hashedQuitPassword.tooltip.confirm=Please confirm the quit password
|
||||||
|
@ -2423,6 +2423,9 @@ sebserver.monitoring.signaturegrant.signature=App Signature Key Hash
|
||||||
sebserver.monitoring.signaturegrant.tag=Tag
|
sebserver.monitoring.signaturegrant.tag=Tag
|
||||||
sebserver.monitoring.signaturegrant.message.granted=This App Signature Key is already granted for this exam
|
sebserver.monitoring.signaturegrant.message.granted=This App Signature Key is already granted for this exam
|
||||||
|
|
||||||
|
sebserver.monitoring.sps.opengallery.fail=Failed to open screen proctoring service group gallery view
|
||||||
|
sebserver.monitoring.sps.noaccess=No Access to Screen Proctoring
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# Finished Exams
|
# Finished Exams
|
||||||
################################
|
################################
|
||||||
|
|
Loading…
Reference in a new issue