Skip to content

Commit

Permalink
SEBSERV-487 defined some features
Browse files Browse the repository at this point in the history
  • Loading branch information
anhefti committed Nov 15, 2023
1 parent a08a72a commit 7079a4f
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 14 deletions.
8 changes: 7 additions & 1 deletion src/main/java/ch/ethz/seb/sebserver/gbl/FeatureService.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

public interface FeatureService {

String SCREEN_PROCTORING_FEATURE_NAME = "seb.screenProctoring";
String INSTITUTION_FEATURE_NAME = "admin.institution";
String REMOTE_PROCTORING_FEATURE_NAME = "seb.remoteProctoring";
String TEST_LMS_FEATURE_NAME = "lms.testLMS";
String EXAM_NO_LMS_FEATURE_NAME = "exam.noLMS";

String FEATURE_SETTINGS_PREFIX = "sebserver.feature.";

boolean isEnabled(LmsType LmsType);
Expand All @@ -22,6 +28,6 @@ public interface FeatureService {

boolean isEnabled(CollectingStrategy collectingRoomStrategy);

boolean isScreenProcteringEnabled();
boolean isEnabled(String featureSuffix);

}
12 changes: 6 additions & 6 deletions src/main/java/ch/ethz/seb/sebserver/gbl/FeatureServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ public boolean isEnabled(final ProctoringServerType proctoringServerType) {
Boolean.TRUE);
}

private String toConfigName(final String key) {
return key.replaceAll("_", "-");
}

@Override
public boolean isScreenProcteringEnabled() {
public boolean isEnabled(final String featureSuffix) {
return this.environment.getProperty(toConfigName(
FEATURE_SETTINGS_PREFIX + "seb.screenProctoring"),
FEATURE_SETTINGS_PREFIX + featureSuffix + ".enabled"),
Boolean.class,
Boolean.FALSE);
}

private String toConfigName(final String key) {
return key.replaceAll("_", "-");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,15 @@ public void compose(final PageContext pageContext) {
this.processTemplateSelection(formHandle.getForm(), formContext);
}

final boolean proctoringEnabled = importFromQuizData ? false : this.restService
final boolean proctoringEnabled = !importFromQuizData && this.restService
.getBuilder(GetExamProctoringSettings.class)
.withURIVariable(API.PARAM_MODEL_ID, entityKey.modelId)
.call()
.map(ProctoringServiceSettings::getEnableProctoring)
.getOr(false);

final boolean screenProctoringEnabled = importFromQuizData ? false : this.restService
final boolean spsFeatureEnabled = this.featureService.isEnabled(FeatureService.SCREEN_PROCTORING_FEATURE_NAME);
final boolean screenProctoringEnabled = spsFeatureEnabled && !importFromQuizData && this.restService
.getBuilder(GetScreenProctoringSettings.class)
.withURIVariable(API.PARAM_MODEL_ID, entityKey.modelId)
.call()
Expand All @@ -430,6 +431,7 @@ public void compose(final PageContext pageContext) {
.clearEntityKeys()
.removeAttribute(AttributeKeys.IMPORT_FROM_QUIZ_DATA));


// propagate content actions to action-pane
actionBuilder

Expand Down Expand Up @@ -514,15 +516,15 @@ public void compose(final PageContext pageContext) {
.withExec(
this.screenProctoringSettingsPopup.settingsFunction(this.pageService, modifyGrant && editable))
.noEventPropagation()
.publishIf(() -> this.featureService.isScreenProcteringEnabled() && screenProctoringEnabled && readonly)
.publishIf(() -> spsFeatureEnabled && screenProctoringEnabled && readonly)

.newAction(ActionDefinition.SCREEN_PROCTORING_OFF)
.withEntityKey(entityKey)
.withExec(
this.screenProctoringSettingsPopup.settingsFunction(this.pageService, modifyGrant && editable))
.noEventPropagation()
.publishIf(
() -> this.featureService.isScreenProcteringEnabled() && !screenProctoringEnabled && readonly)
() -> spsFeatureEnabled && !screenProctoringEnabled && readonly)

;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,13 @@ public WebserviceInfo(
this.lmsExternalAddressAlias = Collections.emptyMap();
}

final boolean spsEnabled = BooleanUtils.toBoolean(environment.getProperty(
"sebserver.feature.seb.screenProctoring.enabled",
Constants.FALSE_STRING));
final boolean spsBundled = BooleanUtils.toBoolean(environment.getProperty(
"sebserver.feature.seb.screenProctoring.bundled",
Constants.FALSE_STRING));
if (spsBundled) {
if (spsEnabled && spsBundled) {
this.screenProctoringServiceBundle = new ScreenProctoringServiceBundle(
environment.getProperty("sebserver.feature.seb.screenProctoring.bundled.url"),
environment.getProperty("sebserver.feature.seb.screenProctoring.bundled.clientId"),
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config/application-dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ sebserver.http.client.connection-request-timeout=10000
sebserver.http.client.read-timeout=60000

# features
sebserver.feature.seb.screenProctoring=true
sebserver.feature.seb.screenProctoring.enabled=true
7 changes: 6 additions & 1 deletion src/main/resources/config/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ sebserver.ssl.redirect.enabled=false
sebserver.ssl.redirect.html.port=8080

# features
sebserver.feature.seb.screenProctoring=false
sebserver.feature.admin.institution.enabled=true
sebserver.feature.seb.remoteProctoring.enabled=true
sebserver.feature.lms.testLMS.enabled=true
sebserver.feature.exam.noLMS.enabled=true

sebserver.feature.seb.screenProctoring.enabled=false
sebserver.feature.seb.screenProctoring.bundled=true
sebserver.feature.seb.screenProctoring.bundled.url=sps-service:8090
sebserver.feature.seb.screenProctoring.bundled.clientId=sebserverClient
Expand Down

0 comments on commit 7079a4f

Please sign in to comment.