From b6e9e55106f42ab9b7734d2f902c5e5d291d8b94 Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 15 Feb 2021 15:34:01 +0100 Subject: [PATCH] SEBWIN-464 added missing attributes and created migration task --- .../impl/rules/BrowserViewModeRule.java | 12 ++- .../impl/rules/IgnoreSEBService.java | 73 +++++++++++++++++++ ..._2__insert_new_security_settings_v.1.1.sql | 36 +++++++++ src/main/resources/messages.properties | 8 +- 4 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/rules/IgnoreSEBService.java create mode 100644 src/main/resources/config/sql/base/V5_2__insert_new_security_settings_v.1.1.sql diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/rules/BrowserViewModeRule.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/rules/BrowserViewModeRule.java index 9f8d3e5c..8d7686f5 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/rules/BrowserViewModeRule.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/rules/BrowserViewModeRule.java @@ -56,7 +56,9 @@ public class BrowserViewModeRule implements ValueChangeRule { if (KEY_TOUCH_OPTIMIZED.equals(attribute.name)) { if (BooleanUtils.toBoolean(value.value)) { context.disableGroup(KEY_MAIN_WINDOW_GROUP); - context.setValue(KEY_BROWSER_VIEW_MODE, "2"); + context.setValue( + KEY_BROWSER_VIEW_MODE, + context.getAttributeByName(KEY_BROWSER_VIEW_MODE).defaultValue); } else { context.setValue(KEY_TOUCH_EXIT, Constants.FALSE_STRING); context.disable(KEY_TOUCH_EXIT); @@ -70,7 +72,9 @@ public class BrowserViewModeRule implements ValueChangeRule { case 1: { context.disable(KEY_TOUCH_EXIT); context.disableGroup(KEY_MAIN_WINDOW_GROUP); - context.setValue(KEY_TOUCH_OPTIMIZED, Constants.FALSE_STRING); + context.setValue( + KEY_TOUCH_OPTIMIZED, + context.getAttributeByName(KEY_TOUCH_OPTIMIZED).defaultValue); break; } case 2: { @@ -79,7 +83,9 @@ public class BrowserViewModeRule implements ValueChangeRule { } default: { context.disable(KEY_TOUCH_EXIT); - context.setValue(KEY_TOUCH_OPTIMIZED, Constants.FALSE_STRING); + context.setValue( + KEY_TOUCH_OPTIMIZED, + context.getAttributeByName(KEY_TOUCH_OPTIMIZED).defaultValue); break; } } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/rules/IgnoreSEBService.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/rules/IgnoreSEBService.java new file mode 100644 index 00000000..e28f0b8e --- /dev/null +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/rules/IgnoreSEBService.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2021 ETH Zürich, Educational Development and Technology (LET) + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +package ch.ethz.seb.sebserver.gui.service.examconfig.impl.rules; + +import org.apache.commons.lang3.BooleanUtils; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; + +import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute; +import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationValue; +import ch.ethz.seb.sebserver.gbl.profile.GuiProfile; +import ch.ethz.seb.sebserver.gui.service.examconfig.ValueChangeRule; +import ch.ethz.seb.sebserver.gui.service.examconfig.impl.ViewContext; + +@Lazy +@Service +@GuiProfile +public class IgnoreSEBService implements ValueChangeRule { + + public static final String KEY_IGNORE_SEB_SERVICE = "sebServiceIgnore"; + + public static final String KEY_SEB_SERVICE_POLICY = "sebServicePolicy"; + public static final String KEY_ATTR_1 = "enableWindowsUpdate"; + public static final String KEY_ATTR_2 = "enableChromeNotifications"; + public static final String KEY_ATTR_3 = "allowScreenSharing"; + + @Override + public boolean observesAttribute(final ConfigurationAttribute attribute) { + return KEY_IGNORE_SEB_SERVICE.equals(attribute.name); + } + + @Override + public void applyRule( + final ViewContext context, + final ConfigurationAttribute attribute, + final ConfigurationValue value) { + + if (KEY_IGNORE_SEB_SERVICE.equals(attribute.name)) { + if (BooleanUtils.toBoolean(value.value)) { + context.disable(KEY_SEB_SERVICE_POLICY); + context.disable(KEY_ATTR_1); + context.disable(KEY_ATTR_2); + context.disable(KEY_ATTR_3); + + context.setValue( + KEY_SEB_SERVICE_POLICY, + context.getAttributeByName(KEY_SEB_SERVICE_POLICY).defaultValue); + context.setValue( + KEY_ATTR_1, + context.getAttributeByName(KEY_ATTR_1).defaultValue); + context.setValue( + KEY_ATTR_2, + context.getAttributeByName(KEY_ATTR_2).defaultValue); + context.setValue( + KEY_ATTR_3, + context.getAttributeByName(KEY_ATTR_3).defaultValue); + } else { + context.enable(KEY_SEB_SERVICE_POLICY); + context.enable(KEY_ATTR_1); + context.enable(KEY_ATTR_2); + context.enable(KEY_ATTR_3); + } + } + + } + +} diff --git a/src/main/resources/config/sql/base/V5_2__insert_new_security_settings_v.1.1.sql b/src/main/resources/config/sql/base/V5_2__insert_new_security_settings_v.1.1.sql new file mode 100644 index 00000000..18207a50 --- /dev/null +++ b/src/main/resources/config/sql/base/V5_2__insert_new_security_settings_v.1.1.sql @@ -0,0 +1,36 @@ +INSERT IGNORE INTO configuration_attribute VALUES + (318, 'sebServiceIgnore', 'CHECKBOX', null, null, null, null, 'true'), + (319, 'allowApplicationLog', 'CHECKBOX', null, null, null, null, 'false'), + (320, 'showApplicationLogButton', 'CHECKBOX', null, null, null, null, 'false'), + (321, 'enableWindowsUpdate', 'CHECKBOX', null, null, null, null, 'false'), + (322, 'enableChromeNotifications', 'CHECKBOX', null, null, null, null, 'false') + ; + + +UPDATE orientation SET y_position='13', width='12' WHERE id='305'; +UPDATE orientation SET y_position='16', width='10' WHERE id='306'; +UPDATE orientation SET y_position='17', width='10' WHERE id='307'; +UPDATE orientation SET y_position='18' WHERE id='317'; +UPDATE orientation SET x_position='0', y_position='9' WHERE id='301'; +UPDATE orientation SET x_position='3', y_position='10', width='4' WHERE id='501'; +UPDATE orientation SET x_position='3', y_position='11', width='4' WHERE id='304'; +UPDATE orientation SET x_position='3', y_position='12', width='4' WHERE id='302'; +UPDATE orientation SET group_id='sebService', x_position='4', y_position='6', width='3' WHERE id='303'; +UPDATE orientation SET group_id='sebService', y_position='2', width='7', title='TOP' WHERE id='300'; +UPDATE orientation SET y_position='3' WHERE id='309'; +UPDATE orientation SET y_position='4' WHERE id='310'; +UPDATE orientation SET y_position='5' WHERE id='311'; +UPDATE orientation SET y_position='6' WHERE id='312'; +UPDATE orientation SET y_position='7' WHERE id='313'; +UPDATE orientation SET y_position='8' WHERE id='314'; +UPDATE orientation SET y_position='11' WHERE id='315'; +UPDATE orientation SET y_position='12' WHERE id='316'; + + +INSERT IGNORE INTO orientation VALUES + (318, 318, 0, 9, 'sebService', 0, 0, 7, 1, 'NONE'), + (319, 319, 0, 9, 'logging', 0, 14, 5, 1, 'NONE'), + (320, 320, 0, 9, 'logging', 0, 15, 5, 1, 'NONE'), + (321, 321, 0, 9, 'sebService', 0, 6, 4, 1, 'NONE'), + (322, 322, 0, 9, 'sebService', 0, 7, 4, 1, 'NONE') + ; \ No newline at end of file diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index bd88c16d..d7ea6256 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -1154,11 +1154,15 @@ sebserver.examconfig.props.label.RTSPUsername=Username sebserver.examconfig.props.label.RTSPPassword=Password -sebserver.examconfig.props.group.servicePolicy=SEB Service policy +sebserver.examconfig.props.group.sebService=SEB Service (Win) +sebserver.examconfig.props.label.sebServicePolicy=IMPORTANT: The SEB Service changes aspects of the system configuration.
Some anti-virus software providers might falsely identify its operation as malicious,
thus it is not recommended to use the SEB Service in uncontrolled environments (e.g. BYOD).


SEB Service policy sebserver.examconfig.props.label.sebServicePolicy.0=allow to run SEB without service sebserver.examconfig.props.label.sebServicePolicy.1=display warning when service is not running sebserver.examconfig.props.label.sebServicePolicy.2=allow to use SEB only with service sebserver.examconfig.props.label.sebServicePolicy.tooltip=Policy that applies when an exam client doesn't have the SEB client running +sebserver.examconfig.props.label.sebServiceIgnore=Ignore SEB Service +sebserver.examconfig.props.label.enableWindowsUpdate=Allow Windows Update to run while SEB is running +sebserver.examconfig.props.label.enableChromeNotifications=Allow notifications from Chrome browsers sebserver.examconfig.props.group.kioskMode=Kiosk Mode sebserver.examconfig.props.label.kioskMode.tooltip=The kiosk mode setting reflects how the computer is locked down in SEB @@ -1220,6 +1224,8 @@ sebserver.examconfig.props.label.logLevel.3=Debug sebserver.examconfig.props.label.logLevel.3.tooltip=Debug is reserved for information which is only necessary for in-deep program code debugging sebserver.examconfig.props.label.logLevel.4=Verbose sebserver.examconfig.props.label.logLevel.4.tooltip=Verbose level contains events of all levels +sebserver.examconfig.props.label.allowApplicationLog=Allow access to application log (Win) +sebserver.examconfig.props.label.showApplicationLogButton=Show log button on taskbar (Win) sebserver.examconfig.props.group.registry=While running SEB sebserver.examconfig.props.group.registry.tooltip=Options in the Windows Security Screen invoked by Ctrl-Alt-Del