Merge branch 'development' of github.com:SafeExamBrowser/seb-server into SEBSP-143
This commit is contained in:
commit
ae37a8cf12
4 changed files with 28 additions and 9 deletions
|
@ -315,7 +315,6 @@ public class FullLmsIntegrationServiceImpl implements FullLmsIntegrationService
|
|||
.getLmsSetupIdByConnectionId(lmsUUID)
|
||||
.flatMap(lmsAPITemplateCacheService::getLmsAPITemplate)
|
||||
.map(template -> getQuizData(template, courseId, quizId, examData))
|
||||
//.map(findQuizData(courseId, quizId))
|
||||
.map(createExam(examTemplateId, quitPassword))
|
||||
.map(exam -> applyExamData(exam, false))
|
||||
.map(this::applyConnectionConfiguration);
|
||||
|
|
|
@ -167,7 +167,7 @@ public class SEBRestrictionServiceImpl implements SEBRestrictionService {
|
|||
return this.applySEBClientRestriction(exam)
|
||||
.flatMap(e -> this.examDAO.setSEBRestriction(e.id, true))
|
||||
.onError(t -> log.error("Failed to update SEB Client restriction for Exam: {}", exam, t))
|
||||
.getOr(exam);
|
||||
.getOrThrow();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -965,10 +965,20 @@ class ScreenProctoringAPIBinding {
|
|||
final JsonNode requestJSON = this.jsonMapper.readTree(getResponse.getBody());
|
||||
final JsonNode content = requestJSON.get("content");
|
||||
if (content.isArray()) {
|
||||
|
||||
final JsonNode sebConnection = content.get(0);
|
||||
spsData.spsSEBAccessUUID = sebConnection.get(SPS_API.SEB_ACCESS.ATTR_UUID).textValue();
|
||||
spsData.spsSEBAccessName = sebConnection.get(SPS_API.SEB_ACCESS.ATTR_CLIENT_NAME).textValue();
|
||||
spsData.spsSEBAccessPWD = sebConnection.get(SPS_API.SEB_ACCESS.ATTR_CLIENT_SECRET).textValue();
|
||||
|
||||
// TODO remove when tested
|
||||
final JsonNode uuidNode = sebConnection.get(SPS_API.SEB_ACCESS.ATTR_UUID);
|
||||
final JsonNode sebClientNode = sebConnection.get(SPS_API.SEB_ACCESS.ATTR_CLIENT_NAME);
|
||||
final JsonNode sebSecretNode = sebConnection.get(SPS_API.SEB_ACCESS.ATTR_CLIENT_SECRET);
|
||||
log.info(" uuidNode: {}", uuidNode);
|
||||
log.info(" sebClientNode: {}", sebClientNode);
|
||||
log.info(" sebSecretNode: {}", sebSecretNode);
|
||||
|
||||
spsData.spsSEBAccessUUID = uuidNode.textValue();
|
||||
spsData.spsSEBAccessName = sebClientNode.textValue();
|
||||
spsData.spsSEBAccessPWD = sebSecretNode.textValue();
|
||||
return;
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
|
|
|
@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import java.io.IOException;
|
||||
import java.io.PipedInputStream;
|
||||
import java.io.PipedOutputStream;
|
||||
import java.util.Arrays;
|
||||
|
||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||
import ch.ethz.seb.sebserver.gbl.api.APIMessage;
|
||||
|
@ -21,6 +22,7 @@ import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
|||
import ch.ethz.seb.sebserver.gbl.model.exam.Exam;
|
||||
import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile;
|
||||
import ch.ethz.seb.sebserver.webservice.WebserviceInfo;
|
||||
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ExamDAO;
|
||||
import ch.ethz.seb.sebserver.webservice.servicelayer.lms.FullLmsIntegrationService;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -41,13 +43,16 @@ public class LmsIntegrationController {
|
|||
|
||||
private final FullLmsIntegrationService fullLmsIntegrationService;
|
||||
private final WebserviceInfo webserviceInfo;
|
||||
private final ExamDAO examDAO;
|
||||
|
||||
public LmsIntegrationController(
|
||||
final FullLmsIntegrationService fullLmsIntegrationService,
|
||||
final WebserviceInfo webserviceInfo) {
|
||||
final WebserviceInfo webserviceInfo,
|
||||
final ExamDAO examDAO) {
|
||||
|
||||
this.fullLmsIntegrationService = fullLmsIntegrationService;
|
||||
this.webserviceInfo = webserviceInfo;
|
||||
this.examDAO = examDAO;
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
|
@ -72,9 +77,14 @@ public class LmsIntegrationController {
|
|||
quitPassword,
|
||||
quitLink,
|
||||
examData)
|
||||
.onError(e -> log.error(
|
||||
"Failed to create/import exam: lmsId:{}, courseId: {}, quizId: {}, templateId: {} error: {}",
|
||||
lmsUUId, courseId, quizId, templateId, e.getMessage()))
|
||||
.onError(e -> {
|
||||
log.error(
|
||||
"Failed to create/import exam: lmsId:{}, courseId: {}, quizId: {}, templateId: {} error: {}",
|
||||
lmsUUId, courseId, quizId, templateId, e.getMessage());
|
||||
log.info("Rollback Exam creation...");
|
||||
fullLmsIntegrationService.deleteExam(lmsUUId, courseId, quizId)
|
||||
.onError(error -> log.error("Failed to rollback auto Exam import: ", error));
|
||||
})
|
||||
.getOrThrow();
|
||||
|
||||
log.info("Auto import of exam successful: {}", exam);
|
||||
|
|
Loading…
Reference in a new issue