From ed28bb7c5da6ac7358b2ecfde5c955bfb680ba93 Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 28 Feb 2022 14:30:20 +0100 Subject: [PATCH] SEBSERV-270 fixed --- .../proctoring/JitsiProctoringService.java | 14 ------ .../proctoring/ZoomProctoringService.java | 14 ------ .../ProctoringSettingsValidator.java | 47 +++++++++++-------- 3 files changed, 28 insertions(+), 47 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/JitsiProctoringService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/JitsiProctoringService.java index 9e0162d5..ab27ce25 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/JitsiProctoringService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/JitsiProctoringService.java @@ -141,20 +141,6 @@ public class JitsiProctoringService implements ExamProctoringService { "proctoringSettings:serverURL:invalidURL"); } - if (StringUtils.isBlank(proctoringSettings.appKey)) { - throw new APIMessageException(Arrays.asList( - APIMessage.fieldValidationError(ProctoringServiceSettings.ATTR_APP_KEY, - "proctoringSettings:appKey:notNull"), - APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR.of())); - } - - if (StringUtils.isBlank(proctoringSettings.appSecret)) { - throw new APIMessageException(Arrays.asList( - APIMessage.fieldValidationError(ProctoringServiceSettings.ATTR_APP_SECRET, - "proctoringSettings:appSecret:notNull"), - APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR.of())); - } - final ClientHttpRequestFactory clientHttpRequestFactory = this.clientHttpRequestFactoryService .getClientHttpRequestFactory() .getOrThrow(); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/ZoomProctoringService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/ZoomProctoringService.java index bc41c1cc..fbbe3bce 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/ZoomProctoringService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/ZoomProctoringService.java @@ -172,20 +172,6 @@ public class ZoomProctoringService implements ExamProctoringService { "proctoringSettings:serverURL:invalidURL"); } - if (StringUtils.isBlank(proctoringSettings.appKey)) { - throw new APIMessageException(Arrays.asList( - APIMessage.fieldValidationError(ProctoringServiceSettings.ATTR_APP_KEY, - "proctoringSettings:appKey:notNull"), - APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR.of())); - } - - if (StringUtils.isBlank(proctoringSettings.appSecret)) { - throw new APIMessageException(Arrays.asList( - APIMessage.fieldValidationError(ProctoringServiceSettings.ATTR_APP_SECRET, - "proctoringSettings:appSecret:notNull"), - APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR.of())); - } - try { final ClientCredentials credentials = new ClientCredentials( diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/validation/ProctoringSettingsValidator.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/validation/ProctoringSettingsValidator.java index 67bc7541..fce6044b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/validation/ProctoringSettingsValidator.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/validation/ProctoringSettingsValidator.java @@ -25,28 +25,37 @@ public class ProctoringSettingsValidator return false; } - if (value.enableProctoring) { - if (value.serverType == ProctoringServerType.JITSI_MEET || value.serverType == ProctoringServerType.ZOOM) { - boolean passed = true; - if (StringUtils.isBlank(value.appKey)) { - context.disableDefaultConstraintViolation(); - context - .buildConstraintViolationWithTemplate("proctoringSettings:appKey:notNull") - .addPropertyNode("appKey").addConstraintViolation(); - passed = false; - } + //if (value.enableProctoring) { + if (value.serverType == ProctoringServerType.JITSI_MEET || value.serverType == ProctoringServerType.ZOOM) { + boolean passed = true; - if (StringUtils.isBlank(value.appSecret)) { - context.disableDefaultConstraintViolation(); - context - .buildConstraintViolationWithTemplate("proctoringSettings:appSecret:notNull") - .addPropertyNode("appSecret").addConstraintViolation(); - passed = false; - } - - return passed; + if (StringUtils.isBlank(value.serverURL)) { + context.disableDefaultConstraintViolation(); + context + .buildConstraintViolationWithTemplate("proctoringSettings:serverURL:notNull") + .addPropertyNode("serverURL").addConstraintViolation(); + passed = false; } + + if (StringUtils.isBlank(value.appKey)) { + context.disableDefaultConstraintViolation(); + context + .buildConstraintViolationWithTemplate("proctoringSettings:appKey:notNull") + .addPropertyNode("appKey").addConstraintViolation(); + passed = false; + } + + if (StringUtils.isBlank(value.appSecret)) { + context.disableDefaultConstraintViolation(); + context + .buildConstraintViolationWithTemplate("proctoringSettings:appSecret:notNull") + .addPropertyNode("appSecret").addConstraintViolation(); + passed = false; + } + + return passed; } + //} return true; }