diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/LoginPage.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/LoginPage.java index 30963de3..88a79c9c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/LoginPage.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/LoginPage.java @@ -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 diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/RegisterPage.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/RegisterPage.java index 00433b02..48f0c3e5 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/RegisterPage.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/RegisterPage.java @@ -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( diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/I18nSupport.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/I18nSupport.java index 80a35e0c..cfee7c7e 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/I18nSupport.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/I18nSupport.java @@ -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 */ diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/I18nSupportImpl.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/I18nSupportImpl.java index 0cc0b2ec..38534c97 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/I18nSupportImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/I18nSupportImpl.java @@ -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 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 diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/RemoteProctoringRoomServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/RemoteProctoringRoomServiceImpl.java index fef45649..387d6433 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/RemoteProctoringRoomServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/RemoteProctoringRoomServiceImpl.java @@ -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; diff --git a/src/main/resources/config/application-dev-ws.properties b/src/main/resources/config/application-dev-ws.properties index 595e7aff..b1b939a5 100644 --- a/src/main/resources/config/application-dev-ws.properties +++ b/src/main/resources/config/application-dev-ws.properties @@ -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 \ No newline at end of file +sebserver.feature.seb.screenProctoring.bundled.sebserveraccount.username=SEBServerAPIAccount + diff --git a/src/main/resources/config/application-gui.properties b/src/main/resources/config/application-gui.properties index 870a9fc8..a037785f 100644 --- a/src/main/resources/config/application-gui.properties +++ b/src/main/resources/config/application-gui.properties @@ -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 diff --git a/src/main/resources/config/application-ws.properties b/src/main/resources/config/application-ws.properties index f518e5ee..ec1f03fb 100644 --- a/src/main/resources/config/application-ws.properties +++ b/src/main/resources/config/application-ws.properties @@ -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