SEBSERV-553 fixed show quit link and improved logging

This commit is contained in:
anhefti 2024-06-25 13:54:15 +02:00
parent 65e717349b
commit abe8bcd4d3
4 changed files with 10 additions and 14 deletions

View file

@ -671,6 +671,11 @@ public class FullLmsIntegrationServiceImpl implements FullLmsIntegrationService
} }
private boolean hasFullIntegration(final Long lmsSetupId) { private boolean hasFullIntegration(final Long lmsSetupId) {
// no LMS
if (lmsSetupId == null) {
return false;
}
final LmsAPITemplate lmsAPITemplate = this.lmsAPITemplateCacheService final LmsAPITemplate lmsAPITemplate = this.lmsAPITemplateCacheService
.getLmsAPITemplate(lmsSetupId) .getLmsAPITemplate(lmsSetupId)
.getOrThrow(); .getOrThrow();

View file

@ -246,8 +246,6 @@ public class MoodlePluginFullIntegration implements FullLmsIntegrationAPI {
final String quizId = MoodleUtils.getQuizId(exam.externalId); final String quizId = MoodleUtils.getQuizId(exam.externalId);
final String fileName = getConnectionConfigFileName(exam); final String fileName = getConnectionConfigFileName(exam);
final MultiValueMap<String, Object> multiPartAttributes = new LinkedMultiValueMap<>(); final MultiValueMap<String, Object> multiPartAttributes = new LinkedMultiValueMap<>();
multiPartAttributes.add("quizid", quizId); multiPartAttributes.add("quizid", quizId);
multiPartAttributes.add("name", fileName); multiPartAttributes.add("name", fileName);
@ -259,19 +257,13 @@ public class MoodlePluginFullIntegration implements FullLmsIntegrationAPI {
} }
}; };
log.info("Upload Connection Configuration to Moodle: quizid: {}, fileName: {}, content: {}", quizId, fileName, contentsAsResource );
multiPartAttributes.add("file", contentsAsResource); multiPartAttributes.add("file", contentsAsResource);
final MoodleAPIRestTemplate rest = getRestTemplate().getOrThrow(); final MoodleAPIRestTemplate rest = getRestTemplate().getOrThrow();
final String response = rest.uploadMultiPart(UPLOAD_ENDPOINT, multiPartAttributes); final String response = rest.uploadMultiPart(UPLOAD_ENDPOINT, multiPartAttributes);
if (response != null && (response.startsWith("{\"exception\":") || response.startsWith("0"))) { if (response != null) {
log.warn("Failed to apply Connection Configuration to LMS for Exam: {}", exam.externalId); log.info("Upload Connection Configuration to Moodle: quizid: {}, fileName: {} response: {}", quizId, fileName, response );
}
if (response != null && (response.startsWith("{\"warnings\":"))) {
log.info("Moodle warnings in response: {}", response);
} }
return exam; return exam;

View file

@ -676,14 +676,12 @@ class ScreenProctoringAPIBinding {
final ScreenProctoringGroup localGroup, final ScreenProctoringGroup localGroup,
final ClientConnectionRecord clientConnection) { final ClientConnectionRecord clientConnection) {
// TODO check if the Session with token UUID already exists and if true, return the token
final String token = clientConnection.getConnectionToken(); final String token = clientConnection.getConnectionToken();
final ScreenProctoringServiceOAuthTemplate apiTemplate = this.getAPITemplate(examId); final ScreenProctoringServiceOAuthTemplate apiTemplate = this.getAPITemplate(examId);
final String uri = UriComponentsBuilder final String uri = UriComponentsBuilder
.fromUriString(apiTemplate.spsAPIAccessData.getSpsServiceURL()) .fromUriString(apiTemplate.spsAPIAccessData.getSpsServiceURL())
.path(SPS_API.SESSION_ENDPOINT) .path(SPS_API.SESSION_ENDPOINT)
.build() .build()
.toUriString(); .toUriString();
@ -983,7 +981,9 @@ class ScreenProctoringAPIBinding {
final MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); final MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.add(SPS_API.EXAM.ATTR_UUID, uuid); params.add(SPS_API.EXAM.ATTR_UUID, uuid);
params.add(SPS_API.EXAM.ATTR_NAME, exam.name); params.add(SPS_API.EXAM.ATTR_NAME, exam.name);
if (exam.getDescription() != null) {
params.add(SPS_API.EXAM.ATTR_DESCRIPTION, exam.getDescription()); params.add(SPS_API.EXAM.ATTR_DESCRIPTION, exam.getDescription());
}
params.add(SPS_API.EXAM.ATTR_URL, exam.getStartURL()); params.add(SPS_API.EXAM.ATTR_URL, exam.getStartURL());
if (!userIds.isEmpty()) { if (!userIds.isEmpty()) {
params.add(SPS_API.EXAM.ATTR_USER_IDS, StringUtils.join(userIds, Constants.LIST_SEPARATOR)); params.add(SPS_API.EXAM.ATTR_USER_IDS, StringUtils.join(userIds, Constants.LIST_SEPARATOR));

View file

@ -60,7 +60,6 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.session.impl.proctoring.Scr
public class ScreenProctoringServiceImpl implements ScreenProctoringService { public class ScreenProctoringServiceImpl implements ScreenProctoringService {
private static final Logger log = LoggerFactory.getLogger(ScreenProctoringServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(ScreenProctoringServiceImpl.class);
private final Cryptor cryptor; private final Cryptor cryptor;
private final ScreenProctoringAPIBinding screenProctoringAPIBinding; private final ScreenProctoringAPIBinding screenProctoringAPIBinding;
private final ScreenProctoringGroupDAO screenProctoringGroupDAO; private final ScreenProctoringGroupDAO screenProctoringGroupDAO;