SEBSERV-417 access token for Moodle

This commit is contained in:
anhefti 2024-04-22 10:56:21 +02:00
parent 6e2feafc5a
commit 568113003d
2 changed files with 4 additions and 4 deletions

View file

@ -392,7 +392,7 @@ public class MoodleRestTemplateFactoryImpl implements MoodleRestTemplateFactory
// NOTE: for some unknown reason, Moodles API error responses come with a 200 OK response HTTP Status
// So this is a special Moodle specific error handling here...
if (body.startsWith("{exception") || body.contains("\"exception\":")) {
if (body != null && (body.startsWith("{exception") || body.contains("\"exception\":"))) {
// if no courses has been found for this page, just return (Plugin)
if (body.contains("nocoursefound")) {
return body;

View file

@ -82,9 +82,9 @@ public class MoodlePluginFullIntegration implements FullLmsIntegrationAPI {
if (StringUtils.isBlank( data.access_token)) {
throw new APIMessage.FieldValidationException("lmsFullIntegration:access_token", "access_token is mandatory");
}
if (data.exam_templates.isEmpty()) {
throw new APIMessage.FieldValidationException("lmsFullIntegration:exam_templates", "exam_templates is mandatory");
}
// if (data.exam_templates.isEmpty()) {
// throw new APIMessage.FieldValidationException("lmsFullIntegration:exam_templates", "exam_templates is mandatory");
// }
// apply
final LmsSetup lmsSetup = this.restTemplateFactory.getApiTemplateDataSupplier().getLmsSetup();