diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ExamConfigImportHandler.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ExamConfigImportHandler.java index b4825106..29ee8d5b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ExamConfigImportHandler.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ExamConfigImportHandler.java @@ -242,7 +242,7 @@ public class ExamConfigImportHandler extends DefaultHandler { final ConfigurationAttribute attribute = this.attributeResolver.apply(attrName); if (attribute == null) { - log.warn("*********************** Save null value: {}", attrName); + log.warn("Import of unknown attribute. name={} value={}", attrName, top.value); return; } @@ -270,11 +270,11 @@ public class ExamConfigImportHandler extends DefaultHandler { } if (value == null) { - log.warn("*********************** Save null value: {}", name); + log.debug("*********************** Save null value: {}", name); } else if (StringUtils.isBlank(value)) { - log.warn("*********************** Save blank value: {}", name); + log.debug("*********************** Save blank value: {}", name); } else { - log.warn("*********************** Save value value: {} : {}", name, value); + log.debug("*********************** Save value value: {} : {}", name, value); } final ConfigurationValue configurationValue = new ConfigurationValue( diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/converter/BooleanConverter.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/converter/BooleanConverter.java index 7ffabf15..2c5c8e06 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/converter/BooleanConverter.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/converter/BooleanConverter.java @@ -16,6 +16,7 @@ import java.util.HashSet; import java.util.Set; import java.util.function.Function; +import org.apache.commons.lang3.StringUtils; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -68,11 +69,16 @@ public class BooleanConverter implements AttributeValueConverter { final ConfigurationValue value, final String template) throws IOException { + String defaultValue = attribute.getDefaultValue(); + if (StringUtils.isBlank(defaultValue)) { + defaultValue = Constants.FALSE_STRING; + } + out.write(Utils.toByteArray( String.format( template, extractName(attribute), - (value.value != null) ? value.value : Constants.FALSE_STRING))); + (value != null && value.value != null) ? value.value : defaultValue))); } } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/converter/KioskModeConverter.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/converter/KioskModeConverter.java index 1c18f0cf..f5dfa6ad 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/converter/KioskModeConverter.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/converter/KioskModeConverter.java @@ -92,10 +92,10 @@ public class KioskModeConverter implements AttributeValueConverter { final String template) throws IOException { final String val = (ATTR_NAME_CREATE_NEW_DESKTOP.equals(name)) - ? value.getValue() == null || "0".equals(value.getValue()) + ? value == null || value.getValue() == null || "0".equals(value.getValue()) ? Constants.TRUE_STRING : Constants.FALSE_STRING - : value.getValue() == null || "0".equals(value.getValue()) + : value == null || value.getValue() == null || "0".equals(value.getValue()) ? Constants.FALSE_STRING : Constants.TRUE_STRING; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/converter/StringConverter.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/converter/StringConverter.java index 132a4c94..17647d6a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/converter/StringConverter.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/converter/StringConverter.java @@ -84,7 +84,7 @@ public class StringConverter implements AttributeValueConverter { final String template, final String emptyTemplate) throws IOException { - final String val = (value.value != null) ? value.value : attribute.getDefaultValue(); + final String val = (value != null && value.value != null) ? value.value : attribute.getDefaultValue(); if (StringUtils.isNotBlank(val)) { out.write(Utils.toByteArray(String.format( template, diff --git a/src/main/resources/data-demo.sql b/src/main/resources/data-demo.sql index 8a351517..d6766305 100644 --- a/src/main/resources/data-demo.sql +++ b/src/main/resources/data-demo.sql @@ -159,6 +159,7 @@ INSERT IGNORE INTO configuration_attribute VALUES (99, 'prohibitedProcesses.identifier', 'TEXT_FIELD', 93, null, null, null, ''), (100, 'prohibitedProcesses.strongKill', 'CHECKBOX', 93, null, null, null, 'false'), (101, 'prohibitedProcesses.currentUser', 'CHECKBOX', 93, null, null, null, 'false'), + (102, 'prohibitedProcesses.user', 'TEXT_FIELD', 93, null, null, null, null), (200, 'URLFilterEnable', 'CHECKBOX', null, null, null, null, 'false'), (201, 'URLFilterEnableContentFilter', 'CHECKBOX', null, null, null, null, 'false'), @@ -261,10 +262,27 @@ INSERT IGNORE INTO configuration_attribute VALUES (519, 'enableF11', 'CHECKBOX', null, null, null, null, 'false'), (520, 'enableF12', 'CHECKBOX', null, null, null, null, 'false'), + (800, 'browserMessagingSocket', 'TEXT_FIELD', null, null, null, null, 'ws:\\localhost:8706'), + (801, 'browserMessagingPingTime', 'INTEGER', null, null, null, null, '120000'), + (802, 'allowPreferencesWindow', 'CHECKBOX', null, null, null, null, 'true'), + (803, 'useAsymmetricOnlyEncryption', 'CHECKBOX', null, null, null, null, 'false'), + (804, 'touchOptimized', 'CHECKBOX', null, null, null, null, 'false'), + (805, 'browserScreenKeyboard', 'CHECKBOX', null, null, null, null, 'false'), + (806, 'newBrowserWindowByScriptPolicy', 'INTEGER', null, null, null, null, '2'), + (807, 'newBrowserWindowByScriptBlockForeign', 'CHECKBOX', null, null, null, null, 'false'), + (808, 'monitorProcesses', 'CHECKBOX', null, null, null, null, 'false'), + (809, 'blacklistURLFilter', 'TEXT_FIELD', null, null, null, null, ''), + (810, 'whitelistURLFilter', 'TEXT_FIELD', null, null, null, null, ''), + (811, 'killExplorerShell', 'CHECKBOX', null, null, null, null, 'false'), + (812, 'allowWlan', 'CHECKBOX', null, null, null, null, 'false'), + (813, 'hookKeys', 'CHECKBOX', null, null, null, null, 'true'), + + (1000, 'originatorVersion', 'TEXT_FIELD', null, null, null, null, 'SEB_Server_0.3.0'), (1001, 'sebConfigPurpose', 'RADIO_SELECTION', null, '0,1', null, null, '0') - + ; + INSERT IGNORE INTO orientation VALUES (1, 1, 0, 1, null, 1, 1, 1, 2, 'LEFT'), (2, 2, 0, 1, null, 1, 3, 1, 1, 'LEFT'), diff --git a/src/main/resources/data-prod.sql b/src/main/resources/data-prod.sql index c4133f26..fd62113d 100644 --- a/src/main/resources/data-prod.sql +++ b/src/main/resources/data-prod.sql @@ -132,6 +132,8 @@ INSERT IGNORE INTO configuration_attribute VALUES (98, 'prohibitedProcesses.originalName', 'TEXT_FIELD', 93, null, null, null, ''), (99, 'prohibitedProcesses.identifier', 'TEXT_FIELD', 93, null, null, null, ''), (100, 'prohibitedProcesses.strongKill', 'CHECKBOX', 93, null, null, null, 'false'), + (101, 'prohibitedProcesses.currentUser', 'CHECKBOX', 93, null, null, null, 'false'), + (102, 'prohibitedProcesses.user', 'TEXT_FIELD', 93, null, null, null, null), (200, 'URLFilterEnable', 'CHECKBOX', null, null, null, null, 'false'), (201, 'URLFilterEnableContentFilter', 'CHECKBOX', null, null, null, null, 'false'), @@ -234,8 +236,25 @@ INSERT IGNORE INTO configuration_attribute VALUES (519, 'enableF11', 'CHECKBOX', null, null, null, null, 'false'), (520, 'enableF12', 'CHECKBOX', null, null, null, null, 'false'), + (800, 'browserMessagingSocket', 'TEXT_FIELD', null, null, null, null, 'ws:\\localhost:8706'), + (801, 'browserMessagingPingTime', 'INTEGER', null, null, null, null, '120000'), + (802, 'allowPreferencesWindow', 'CHECKBOX', null, null, null, null, 'true'), + (803, 'useAsymmetricOnlyEncryption', 'CHECKBOX', null, null, null, null, 'false'), + (804, 'touchOptimized', 'CHECKBOX', null, null, null, null, 'false'), + (805, 'browserScreenKeyboard', 'CHECKBOX', null, null, null, null, 'false'), + (806, 'newBrowserWindowByScriptPolicy', 'INTEGER', null, null, null, null, '2'), + (807, 'newBrowserWindowByScriptBlockForeign', 'CHECKBOX', null, null, null, null, 'false'), + (808, 'monitorProcesses', 'CHECKBOX', null, null, null, null, 'false'), + (809, 'blacklistURLFilter', 'TEXT_FIELD', null, null, null, null, ''), + (810, 'whitelistURLFilter', 'TEXT_FIELD', null, null, null, null, ''), + (811, 'killExplorerShell', 'CHECKBOX', null, null, null, null, 'false'), + (812, 'allowWlan', 'CHECKBOX', null, null, null, null, 'false'), + (813, 'hookKeys', 'CHECKBOX', null, null, null, null, 'true'), + + (1000, 'originatorVersion', 'TEXT_FIELD', null, null, null, null, 'SEB_Server_0.3.0'), (1001, 'sebConfigPurpose', 'RADIO_SELECTION', null, '0,1', null, null, '0') + ; INSERT IGNORE INTO orientation VALUES diff --git a/src/test/java/ch/ethz/seb/sebserver/webservice/integration/api/exam/SebExamConfigurationRequestTest.java b/src/test/java/ch/ethz/seb/sebserver/webservice/integration/api/exam/SebExamConfigurationRequestTest.java index 272804e5..543ac3cd 100644 --- a/src/test/java/ch/ethz/seb/sebserver/webservice/integration/api/exam/SebExamConfigurationRequestTest.java +++ b/src/test/java/ch/ethz/seb/sebserver/webservice/integration/api/exam/SebExamConfigurationRequestTest.java @@ -58,7 +58,7 @@ public class SebExamConfigurationRequestTest extends ExamAPIIntegrationTester { final String contentAsString = configResponse.getContentAsString(); assertEquals( - "allowAudioCaptureallowBrowsingBackForwardallowDictionaryLookupallowDisplayMirroringallowDownUploadsallowedDisplayBuiltinallowedDisplaysMaxNumber1allowFlashFullscreenallowPDFPlugInallowQuitallowScreenSharingallowSiriallowSpellCheckallowSpellCheckDictionaryda-DKen-AUen-GBen-USes-ESfr-FRpt-PTsv-SEsv-FIallowSwitchToApplicationsallowUserAppFolderInstallallowVideoCaptureallowVirtualMachineaudioControlEnabledaudioMuteaudioSetVolumeLevelaudioVolumeLevel25blockPopUpWindowsbrowserUserAgentbrowserUserAgentMac0browserUserAgentMacCustombrowserUserAgentWinDesktopMode0browserUserAgentWinDesktopModeCustombrowserUserAgentWinTouchMode0browserUserAgentWinTouchModeCustombrowserViewMode0browserWindowAllowReloadbrowserWindowTitleSuffixchooseFileToUploadPolicy0createNewDesktopdetectStoppedProcessdownloadAndOpenSebConfigdownloadDirectoryOSXdownloadDirectoryWindownloadPDFFilesenableAltEscenableAltF4enableAltMouseWheelenableAltTabenableAppSwitcherCheckenableBrowserWindowToolbarenableCtrlEscenableEscenableF1enableF10enableF11enableF12enableF2enableF3enableF4enableF5enableF6enableF7enableF8enableF9enableJavaenableJavaScriptenableLoggingenablePlugInsenablePrintScreenenablePrivateClipboardenableRightMouseenableSebBrowserenableStartMenuenableTouchExitenableZoomPageenableZoomTextexitKey12exitKey210exitKey35forceAppFolderInstallhashedAdminPasswordhashedQuitPasswordhideBrowserWindowToolbarignoreExitKeysinsideSebEnableChangeAPasswordinsideSebEnableEaseOfAccessinsideSebEnableLockThisComputerinsideSebEnableLogOffinsideSebEnableNetworkConnectionSelectorinsideSebEnableShutDowninsideSebEnableStartTaskManagerinsideSebEnableSwitchUserinsideSebEnableVmWareClientShadekillExplorerShelllogDirectoryOSX~/DocumentslogDirectoryWinlogLevel1mainBrowserWindowHeight100%mainBrowserWindowPositioning1mainBrowserWindowWidth100%minMacOSVersion0newBrowserWindowAllowReloadnewBrowserWindowByLinkBlockForeignnewBrowserWindowByLinkHeight100%newBrowserWindowByLinkPolicy2newBrowserWindowByLinkPositioning2newBrowserWindowByLinkWidth100%newBrowserWindowNavigationnewBrowserWindowShowReloadWarningopenDownloadsoriginatorVersionSEB_Server_0.3.0permittedProcessesprohibitedProcessesproxiesAutoConfigurationEnabledAutoConfigurationJavaScriptAutoConfigurationURLAutoDiscoveryEnabledExceptionsListExcludeSimpleHostnamesFTPEnableFTPPassiveFTPPasswordFTPPort21FTPProxyFTPRequiresPasswordFTPUsernameHTTPEnableHTTPPasswordHTTPPort80HTTPProxyHTTPRequiresPasswordHTTPSEnableHTTPSPasswordHTTPSPort443HTTPSProxyHTTPSRequiresPasswordHTTPSUsernameHTTPUsernameRTSPEnableRTSPPasswordRTSPPort1080RTSPProxyRTSPRequiresPasswordRTSPUsernameSOCKSEnableSOCKSPasswordSOCKSPort1080SOCKSProxySOCKSRequiresPasswordSOCKSUsernameproxySettingsPolicy0quitURLquitURLConfirmremoveBrowserProfileremoveLocalStoragerestartExamPasswordProtectedrestartExamTextrestartExamURLrestartExamUseStartURLsebConfigPurpose0sebServicePolicy2showInputLanguageshowMenuBarshowReloadButtonshowReloadWarningshowTaskBarshowTimetaskBarHeight40URLFilterEnableURLFilterEnableContentFilterURLFilterRuleszoomMode0", + "allowAudioCaptureallowBrowsingBackForwardallowDictionaryLookupallowDisplayMirroringallowDownUploadsallowedDisplayBuiltinallowedDisplaysMaxNumber1allowFlashFullscreenallowPDFPlugInallowPreferencesWindowallowQuitallowScreenSharingallowSiriallowSpellCheckallowSpellCheckDictionaryda-DKen-AUen-GBen-USes-ESfr-FRpt-PTsv-SEsv-FIallowSwitchToApplicationsallowUserAppFolderInstallallowVideoCaptureallowVirtualMachineallowWlanaudioControlEnabledaudioMuteaudioSetVolumeLevelaudioVolumeLevel25blacklistURLFilterblockPopUpWindowsbrowserMessagingPingTime120000browserMessagingSocketws:\\\\localhost:8706browserScreenKeyboardbrowserUserAgentbrowserUserAgentMac0browserUserAgentMacCustombrowserUserAgentWinDesktopMode0browserUserAgentWinDesktopModeCustombrowserUserAgentWinTouchMode0browserUserAgentWinTouchModeCustombrowserViewMode0browserWindowAllowReloadbrowserWindowTitleSuffixchooseFileToUploadPolicy0createNewDesktopcreateNewDesktopdetectStoppedProcessdownloadAndOpenSebConfigdownloadDirectoryOSXdownloadDirectoryWindownloadPDFFilesenableAltEscenableAltF4enableAltMouseWheelenableAltTabenableAppSwitcherCheckenableBrowserWindowToolbarenableCtrlEscenableEscenableF1enableF10enableF11enableF12enableF2enableF3enableF4enableF5enableF6enableF7enableF8enableF9enableJavaenableJavaScriptenableLoggingenablePlugInsenablePrintScreenenablePrivateClipboardenableRightMouseenableSebBrowserenableStartMenuenableTouchExitenableZoomPageenableZoomTextexitKey12exitKey210exitKey35forceAppFolderInstallhashedAdminPasswordhashedQuitPasswordhideBrowserWindowToolbarhookKeysignoreExitKeysinsideSebEnableChangeAPasswordinsideSebEnableEaseOfAccessinsideSebEnableLockThisComputerinsideSebEnableLogOffinsideSebEnableNetworkConnectionSelectorinsideSebEnableShutDowninsideSebEnableStartTaskManagerinsideSebEnableSwitchUserinsideSebEnableVmWareClientShadekillExplorerShellkillExplorerShelllogDirectoryOSX~/DocumentslogDirectoryWinlogLevel1mainBrowserWindowHeight100%mainBrowserWindowPositioning1mainBrowserWindowWidth100%minMacOSVersion0monitorProcessesnewBrowserWindowAllowReloadnewBrowserWindowByLinkBlockForeignnewBrowserWindowByLinkHeight100%newBrowserWindowByLinkPolicy2newBrowserWindowByLinkPositioning2newBrowserWindowByLinkWidth100%newBrowserWindowByScriptBlockForeignnewBrowserWindowByScriptPolicy2newBrowserWindowNavigationnewBrowserWindowShowReloadWarningopenDownloadsoriginatorVersionSEB_Server_0.3.0permittedProcessesprohibitedProcessesproxiesAutoConfigurationEnabledAutoConfigurationJavaScriptAutoConfigurationURLAutoDiscoveryEnabledExceptionsListExcludeSimpleHostnamesFTPEnableFTPPassiveFTPPasswordFTPPort21FTPProxyFTPRequiresPasswordFTPUsernameHTTPEnableHTTPPasswordHTTPPort80HTTPProxyHTTPRequiresPasswordHTTPSEnableHTTPSPasswordHTTPSPort443HTTPSProxyHTTPSRequiresPasswordHTTPSUsernameHTTPUsernameRTSPEnableRTSPPasswordRTSPPort1080RTSPProxyRTSPRequiresPasswordRTSPUsernameSOCKSEnableSOCKSPasswordSOCKSPort1080SOCKSProxySOCKSRequiresPasswordSOCKSUsernameproxySettingsPolicy0quitURLquitURLConfirmremoveBrowserProfileremoveLocalStoragerestartExamPasswordProtectedrestartExamTextrestartExamURLrestartExamUseStartURLsebConfigPurpose0sebServicePolicy2showInputLanguageshowMenuBarshowReloadButtonshowReloadWarningshowTaskBarshowTimetaskBarHeight40touchOptimizedURLFilterEnableURLFilterEnableContentFilterURLFilterRulesuseAsymmetricOnlyEncryptionwhitelistURLFilterzoomMode0", contentAsString); // check cache diff --git a/src/test/resources/data-test-additional.sql b/src/test/resources/data-test-additional.sql index afb14374..da3d287c 100644 --- a/src/test/resources/data-test-additional.sql +++ b/src/test/resources/data-test-additional.sql @@ -139,6 +139,8 @@ INSERT IGNORE INTO configuration_attribute VALUES (98, 'prohibitedProcesses.originalName', 'TEXT_FIELD', 93, null, null, null, ''), (99, 'prohibitedProcesses.identifier', 'TEXT_FIELD', 93, null, null, null, ''), (100, 'prohibitedProcesses.strongKill', 'CHECKBOX', 93, null, null, null, 'false'), + (101, 'prohibitedProcesses.currentUser', 'CHECKBOX', 93, null, null, null, 'false'), + (102, 'prohibitedProcesses.user', 'TEXT_FIELD', 93, null, null, null, null), (200, 'URLFilterEnable', 'CHECKBOX', null, null, null, null, 'false'), (201, 'URLFilterEnableContentFilter', 'CHECKBOX', null, null, null, null, 'false'), @@ -146,7 +148,7 @@ INSERT IGNORE INTO configuration_attribute VALUES (203, 'URLFilterRules.active', 'CHECKBOX', 202, null, null, null, 'true'), (204, 'URLFilterRules.regex', 'CHECKBOX', 202, null, null, null, 'false'), (205, 'URLFilterRules.expression', 'TEXT_FIELD', 202, null, null, null, ''), - (206, 'URLFilterRules.action', 'SINGLE_SELECTION', 202, '0,1', null, null, ''), + (206, 'URLFilterRules.action', 'SINGLE_SELECTION', 202, '0,1', null, null, '0'), (210, 'proxySettingsPolicy', 'RADIO_SELECTION', null, '0,1', null, null, '0'), (220, 'proxies', 'COMPOSITE_TABLE', null, 'active,TABLE_ENTRY|autoDiscovery,autoConfiguration,http,https,ftp,socks,rtsp', null, null, null), @@ -241,10 +243,27 @@ INSERT IGNORE INTO configuration_attribute VALUES (519, 'enableF11', 'CHECKBOX', null, null, null, null, 'false'), (520, 'enableF12', 'CHECKBOX', null, null, null, null, 'false'), + (800, 'browserMessagingSocket', 'TEXT_FIELD', null, null, null, null, 'ws:\\localhost:8706'), + (801, 'browserMessagingPingTime', 'INTEGER', null, null, null, null, '120000'), + (802, 'allowPreferencesWindow', 'CHECKBOX', null, null, null, null, 'true'), + (803, 'useAsymmetricOnlyEncryption', 'CHECKBOX', null, null, null, null, 'false'), + (804, 'touchOptimized', 'CHECKBOX', null, null, null, null, 'false'), + (805, 'browserScreenKeyboard', 'CHECKBOX', null, null, null, null, 'false'), + (806, 'newBrowserWindowByScriptPolicy', 'INTEGER', null, null, null, null, '2'), + (807, 'newBrowserWindowByScriptBlockForeign', 'CHECKBOX', null, null, null, null, 'false'), + (808, 'monitorProcesses', 'CHECKBOX', null, null, null, null, 'false'), + (809, 'blacklistURLFilter', 'TEXT_FIELD', null, null, null, null, ''), + (810, 'whitelistURLFilter', 'TEXT_FIELD', null, null, null, null, ''), + (811, 'killExplorerShell', 'CHECKBOX', null, null, null, null, 'false'), + (812, 'allowWlan', 'CHECKBOX', null, null, null, null, 'false'), + (813, 'hookKeys', 'CHECKBOX', null, null, null, null, 'true'), + + (1000, 'originatorVersion', 'TEXT_FIELD', null, null, null, null, 'SEB_Server_0.3.0'), (1001, 'sebConfigPurpose', 'RADIO_SELECTION', null, '0,1', null, null, '0') - + ; + INSERT IGNORE INTO orientation VALUES (1, 1, 0, 1, null, 1, 1, 1, 2, 'LEFT'), (2, 2, 0, 1, null, 1, 3, 1, 1, 'LEFT'),