Prepared for new LMS Setups
This commit is contained in:
parent
89c2406b4e
commit
3c5373ebc4
4 changed files with 19 additions and 24 deletions
|
@ -39,14 +39,15 @@ public final class LmsSetup implements GrantEntity, Activatable {
|
|||
|
||||
public enum Features {
|
||||
COURSE_API,
|
||||
SEB_RESTRICTION,
|
||||
COURSE_STRUCTURE_API,
|
||||
SEB_RESTRICTION
|
||||
}
|
||||
|
||||
public enum LmsType {
|
||||
MOCKUP(Features.COURSE_API),
|
||||
OPEN_EDX(Features.COURSE_API, Features.SEB_RESTRICTION),
|
||||
MOODLE(Features.COURSE_API /* , Features.SEB_RESTRICTION */);
|
||||
MOODLE(Features.COURSE_API /* , Features.SEB_RESTRICTION */),
|
||||
ANS_DELFT(/* Features.COURSE_API , Features.SEB_RESTRICTION */),
|
||||
OPEN_OLAT(/* Features.COURSE_API , Features.SEB_RESTRICTION */);
|
||||
|
||||
public final EnumSet<Features> features;
|
||||
|
||||
|
|
|
@ -18,13 +18,14 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import ch.ethz.seb.sebserver.gbl.Constants;
|
||||
|
@ -117,6 +118,8 @@ public class ResourceService {
|
|||
public static final String EXAM_PROCTORING_TYPE_PREFIX = "sebserver.exam.proctoring.type.servertype.";
|
||||
public static final String VDI_TYPE_PREFIX = "sebserver.clientconfig.form.vditype.";
|
||||
|
||||
private static final String DISABLE_LMS_FLAG = "sebserver.gui.webservice.lms.disable.";
|
||||
|
||||
public static final EnumSet<AttributeType> ATTRIBUTE_TYPES_NOT_DISPLAYED = EnumSet.of(
|
||||
AttributeType.LABEL,
|
||||
AttributeType.COMPOSITE_TABLE,
|
||||
|
@ -134,30 +137,24 @@ public class ResourceService {
|
|||
private final I18nSupport i18nSupport;
|
||||
private final RestService restService;
|
||||
private final CurrentUser currentUser;
|
||||
private final EnumSet<LmsType> enabledLmsTypes;
|
||||
private final EnumSet<LmsType> disabledLmsTypes;
|
||||
|
||||
protected ResourceService(
|
||||
final I18nSupport i18nSupport,
|
||||
final RestService restService,
|
||||
final CurrentUser currentUser,
|
||||
@Value("${sebserver.gui.webservice.mock-lms-enabled:true}") final boolean mock_lms_enabled,
|
||||
@Value("${sebserver.gui.webservice.edx-lms-enabled:true}") final boolean edx_lms_enabled,
|
||||
@Value("${sebserver.gui.webservice.moodle-lms-enabled:true}") final boolean moodle_lms_enabled) {
|
||||
final Environment environment) {
|
||||
|
||||
this.i18nSupport = i18nSupport;
|
||||
this.restService = restService;
|
||||
this.currentUser = currentUser;
|
||||
|
||||
this.enabledLmsTypes = EnumSet.noneOf(LmsType.class);
|
||||
if (mock_lms_enabled) {
|
||||
this.enabledLmsTypes.add(LmsType.MOCKUP);
|
||||
}
|
||||
if (edx_lms_enabled) {
|
||||
this.enabledLmsTypes.add(LmsType.OPEN_EDX);
|
||||
}
|
||||
if (moodle_lms_enabled) {
|
||||
this.enabledLmsTypes.add(LmsType.MOODLE);
|
||||
}
|
||||
this.disabledLmsTypes = EnumSet.noneOf(LmsType.class);
|
||||
final List<LmsType> disabled = Arrays.asList(LmsType.values()).stream()
|
||||
.filter(lmsType -> lmsType.features.isEmpty() ||
|
||||
environment.getProperty(DISABLE_LMS_FLAG + lmsType.name(), Boolean.class, false) == true)
|
||||
.collect(Collectors.toList());
|
||||
this.disabledLmsTypes.addAll(disabled);
|
||||
}
|
||||
|
||||
public I18nSupport getI18nSupport() {
|
||||
|
@ -187,7 +184,7 @@ public class ResourceService {
|
|||
|
||||
public List<Tuple<String>> lmsTypeResources() {
|
||||
return Arrays.stream(LmsType.values())
|
||||
.filter(this.enabledLmsTypes::contains)
|
||||
.filter(Predicate.not(this.disabledLmsTypes::contains))
|
||||
.map(lmsType -> new Tuple<>(
|
||||
lmsType.name(),
|
||||
this.i18nSupport.getText(LMSSETUP_TYPE_PREFIX + lmsType.name(), lmsType.name())))
|
||||
|
|
|
@ -10,11 +10,6 @@ sebserver.gui.webservice.apipath=/admin-api/v1
|
|||
# defines the polling interval that is used to poll the webservice for client connection data on a monitored exam page
|
||||
sebserver.gui.webservice.poll-interval=1000
|
||||
|
||||
sebserver.gui.webservice.mock-lms-enabled=true
|
||||
sebserver.gui.webservice.edx-lms-enabled=true
|
||||
sebserver.gui.webservice.moodle-lms-enabled=true
|
||||
|
||||
|
||||
sebserver.gui.theme=css/sebserver.css
|
||||
sebserver.gui.list.page.size=15
|
||||
|
||||
|
|
|
@ -283,6 +283,8 @@ sebserver.useraccount.delete.confirm.message.noDeps=The User Account ({0}) was s
|
|||
sebserver.lmssetup.type.MOCKUP=Testing
|
||||
sebserver.lmssetup.type.MOODLE=Moodle
|
||||
sebserver.lmssetup.type.OPEN_EDX=Open edX
|
||||
sebserver.lmssetup.type.ANS_DELFT=Ans Delft
|
||||
sebserver.lmssetup.type.OPEN_OLAT=Open OLAT
|
||||
|
||||
sebserver.lmssetup.list.actions=
|
||||
sebserver.lmssetup.list.action.no.modify.privilege=No Access: A LMS Setup from other institution cannot be modified.
|
||||
|
|
Loading…
Reference in a new issue