minor cleanups
This commit is contained in:
parent
0029cd4ec3
commit
8376a1c3fd
2 changed files with 6 additions and 7 deletions
|
@ -118,7 +118,8 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
|
|||
this.getRestTemplate().get();
|
||||
}
|
||||
catch (Exception e) {
|
||||
return LmsSetupTestResult.ofQuizAccessAPIError(LmsType.OPEN_OLAT, "Unspecific error connecting to OLAT API");
|
||||
log.error("Failed to access OLAT course API: ", e);
|
||||
return LmsSetupTestResult.ofQuizAccessAPIError(LmsType.OPEN_OLAT, e.getMessage());
|
||||
}
|
||||
return LmsSetupTestResult.ofOkay(LmsType.OPEN_OLAT);
|
||||
}
|
||||
|
@ -349,9 +350,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
|
|||
|
||||
@Override
|
||||
public Result<Exam> releaseSEBClientRestriction(final Exam exam) {
|
||||
@SuppressWarnings("unused")
|
||||
final String quizId = exam.externalId;
|
||||
|
||||
return getRestTemplate()
|
||||
.map(t -> this.deleteRestrictionForAssignmentId(t, exam.externalId))
|
||||
.map(x -> exam);
|
||||
|
@ -403,6 +402,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
|
|||
private Result<OlatLmsRestTemplate> getRestTemplate() {
|
||||
return Result.tryCatch(() -> {
|
||||
if (this.cachedRestTemplate != null) { return this.cachedRestTemplate; }
|
||||
|
||||
final LmsSetup lmsSetup = this.apiTemplateDataSupplier.getLmsSetup();
|
||||
final ClientCredentials credentials = this.apiTemplateDataSupplier.getLmsClientCredentials();
|
||||
final ProxyData proxyData = this.apiTemplateDataSupplier.getProxyData();
|
||||
|
@ -425,7 +425,6 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
|
|||
template.setRequestFactory(clientHttpRequestFactory);
|
||||
|
||||
this.cachedRestTemplate = template;
|
||||
|
||||
return this.cachedRestTemplate;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class OlatLmsRestTemplate extends RestTemplate {
|
|||
|
||||
private static final Logger log = LoggerFactory.getLogger(OlatLmsRestTemplate.class);
|
||||
|
||||
public String token;
|
||||
private String token;
|
||||
private ClientCredentialsResourceDetails details;
|
||||
|
||||
public OlatLmsRestTemplate(ClientCredentialsResourceDetails details) {
|
||||
|
@ -68,8 +68,8 @@ public class OlatLmsRestTemplate extends RestTemplate {
|
|||
details.getClientId(),
|
||||
details.getClientSecret());
|
||||
try {
|
||||
ResponseEntity<String> response = this.getForEntity(authUrl, String.class);
|
||||
HttpHeaders responseHeaders = response.getHeaders();
|
||||
final ResponseEntity<String> response = this.getForEntity(authUrl, String.class);
|
||||
final HttpHeaders responseHeaders = response.getHeaders();
|
||||
log.debug("OLAT [authenticate] {} Headers: {}", response.getStatusCode(), responseHeaders);
|
||||
token = responseHeaders.getFirst("X-OLAT-TOKEN");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue