SEBSERV-460 implemented

This commit is contained in:
anhefti 2023-12-06 16:46:22 +01:00
parent 3fa60445e0
commit a9d272428f
8 changed files with 40 additions and 22 deletions

View file

@ -59,7 +59,7 @@ public class LoginPage implements TemplateComposer {
public LoginPage(
final PageService pageService,
final DefaultRegisterPage defaultRegisterPage,
@Value("${sebserver.gui.self-registering:false}") final Boolean registeringEnabled) {
@Value("${sebserver.gui.registering:false}") final Boolean registeringEnabled) {
this.pageService = pageService;
this.authorizationContextHolder = pageService.getAuthorizationContextHolder();
@ -67,6 +67,7 @@ public class LoginPage implements TemplateComposer {
this.i18nSupport = pageService.getI18nSupport();
this.defaultRegisterPage = defaultRegisterPage;
this.registeringEnabled = BooleanUtils.toBoolean(registeringEnabled);
}
@Override

View file

@ -91,6 +91,8 @@ public class RegisterPage implements TemplateComposer {
private final RestTemplate restTemplate;
private final boolean multilingual;
protected RegisterPage(
final PageService pageService,
final WebserviceURIService webserviceURIService,
@ -200,7 +202,7 @@ public class RegisterPage implements TemplateComposer {
.addField(FormBuilder.singleSelection(
Domain.USER.ATTR_TIMEZONE,
FORM_TIMEZONE_TEXT_KEY,
Constants.DEFAULT_TIME_ZONE_CODE,
this.pageService.getI18nSupport().getDefaultTimeZone().getID(),
this.resourceService::timeZoneResources)
.mandatory())
.addField(FormBuilder.text(

View file

@ -14,6 +14,7 @@ import java.util.Locale;
import org.joda.time.DateTime;
import ch.ethz.seb.sebserver.gbl.util.Utils;
import org.joda.time.DateTimeZone;
public interface I18nSupport {
@ -22,6 +23,8 @@ public interface I18nSupport {
String FORMAL_LOCALE_KEY = "sebserver.gui.date.displayformat";
String ATTR_CURRENT_SESSION_LOCALE = "CURRENT_SESSION_LOCALE";
DateTimeZone getDefaultTimeZone();
/** Get all supported languages as a collection of Locale
*
* @return all supported languages as a collection of Locale */

View file

@ -22,6 +22,7 @@ import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.env.Environment;
@ -48,14 +49,16 @@ public class I18nSupportImpl implements I18nSupport {
private final Locale defaultLocale = Locale.ENGLISH;
private final Collection<Locale> supportedLanguages;
private DateTimeZone defaultTimeZone;
public I18nSupportImpl(
final CurrentUser currentUser,
final MessageSource messageSource,
final Environment environment) {
final Environment environment,
@Value("${sebserver.gui.registering.default.timeZone:UTC}") final String defaultTimeZone) {
this.currentUser = currentUser;
this.messageSource = messageSource;
final String defaultFormatLocaleString = environment.getProperty(
FORMAL_LOCALE_KEY,
Constants.DEFAULT_LANG_CODE);
@ -79,6 +82,17 @@ public class I18nSupportImpl implements I18nSupport {
this.supportedLanguages = Utils.immutableCollectionOf(Locale.ENGLISH);
}
try {
this.defaultTimeZone = DateTimeZone.forID(defaultTimeZone);
} catch (final Exception e) {
log.warn("Failed to set default time zone from configuration: ", e);
this.defaultTimeZone = DateTimeZone.forID(Constants.DEFAULT_TIME_ZONE_CODE);
}
}
@Override
public DateTimeZone getDefaultTimeZone() {
return defaultTimeZone;
}
@Override

View file

@ -73,7 +73,7 @@ public class RemoteProctoringRoomServiceImpl implements RemoteProctoringRoomServ
final ProctoringAdminService proctoringAdminService,
final ExamSessionService examSessionService,
final SEBClientInstructionService sebInstructionService,
@Value("${sebserver.webservice.proctoring.resetBroadcastOnLeav:true}") final boolean sendBroadcastReset) {
@Value("${sebserver.webservice.proctoring.resetBroadcastOnLeave:true}") final boolean sendBroadcastReset) {
this.remoteProctoringRoomDAO = remoteProctoringRoomDAO;
this.clientConnectionDAO = clientConnectionDAO;

View file

@ -54,16 +54,23 @@ sebserver.webservice.lms.moodle.api.token.request.paths=
sebserver.webservice.lms.address.alias=lms.mockup.com=lms.address.alias
sebserver.webservice.cache.moodle.course.pageSize=250
springdoc.api-docs.enabled=true
springdoc.swagger-ui.enabled=true
# actuator configuration
management.server.port=${server.port}
management.endpoints.web.base-path=/management
management.endpoints.web.exposure.include=logfile,loggers,jolokia
management.endpoints.web.path-mapping.jolokia=jmx
### Open API Documentation
springdoc.api-docs.enabled=true
springdoc.swagger-ui.enabled=true
springdoc.swagger-ui.oauth.clientId=guiClient
springdoc.swagger-ui.oauth.clientSecret=${sebserver.password}
#springdoc.consumes-to-match=application/json,application/x-www-form-urlencoded
#springdoc.default-consumes-media-type=application/x-www-form-urlencoded
springdoc.paths-to-exclude=/exam-api,/exam-api/discovery,/sebserver/error,/sebserver/check,/oauth,/exam-api/v1/*
sebserver.feature.seb.screenProctoring.bundled=true
sebserver.feature.seb.screenProctoring.bundled.url=http://localhost:8090
sebserver.feature.seb.screenProctoring.bundled.clientId=sebserverClient
sebserver.feature.seb.screenProctoring.bundled.sebserveraccount.username=SEBServerAPIAccount
sebserver.feature.seb.screenProctoring.bundled.sebserveraccount.username=SEBServerAPIAccount

View file

@ -9,7 +9,8 @@ sebserver.gui.list.page.size=20
sebserver.gui.defaultLogo=classpath:/static/images/sebserver-logo.png
# User Account
sebserver.gui.self-registering=true
sebserver.gui.registering=true
sebserver.gui.registering.default.timeZone=Europe/Zurich
sebserver.gui.multilingual=false
sebserver.gui.supported.languages=en
sebserver.gui.date.displayformat=de

View file

@ -47,16 +47,6 @@ sebserver.webservice.http.external.port=
sebserver.webservice.http.redirect.gui=/gui
sebserver.webservice.ping.service.strategy=BLOCKING
### Open API Documentation
springdoc.api-docs.enabled=false
springdoc.swagger-ui.enabled=false
springdoc.swagger-ui.oauth.clientId=guiClient
springdoc.swagger-ui.oauth.clientSecret=${sebserver.password}
#springdoc.consumes-to-match=application/json,application/x-www-form-urlencoded
#springdoc.default-consumes-media-type=application/x-www-form-urlencoded
springdoc.paths-to-exclude=/exam-api,/exam-api/discovery,/sebserver/error,/sebserver/check,/oauth,/exam-api/v1/*
### webservice API
sebserver.webservice.api.admin.clientId=guiClient
@ -74,7 +64,7 @@ sebserver.webservice.api.exam.config.init.permittedProcesses=config/initialPermi
sebserver.webservice.api.exam.config.init.prohibitedProcesses=config/initialProhibitedProcesses.xml
sebserver.webservice.api.exam.endpoint=/exam-api
sebserver.webservice.api.exam.endpoint.discovery=${sebserver.webservice.api.exam.endpoint}/discovery
sebserver.webservice.api.exam.endpoint.v1=${sebserver.webservice.api.exam.endpoint}/v1
sebserver.webservice.api.exam.endpoint.v1=${sebserver.webservice.api.exam.endpoint}/v1
sebserver.webservice.api.exam.accessTokenValiditySeconds=43200
sebserver.webservice.api.exam.enable-indicator-cache=true
sebserver.webservice.api.pagination.maxPageSize=500
@ -88,7 +78,7 @@ sebserver.webservice.lms.olat.sendAdditionalAttributesWithRestriction=false
sebserver.webservice.lms.address.alias=
sebserver.webservice.lms.datafetch.validity.seconds=600
sebserver.webservice.proctoring.resetBroadcastOnLeav=true
sebserver.webservice.proctoring.resetBroadcastOnLeave=true
sebserver.webservice.proctoring.zoom.enableWaitingRoom=false
sebserver.webservice.proctoring.zoom.sendRejoinForCollectingRoom=false