SEBWIN-367: Implemented mapping for service configuration values and added new options in configuration tool.
This commit is contained in:
		
							parent
							
								
									2b7ff4561a
								
							
						
					
					
						commit
						ba4d4cec81
					
				
					 8 changed files with 2208 additions and 1949 deletions
				
			
		|  | @ -23,6 +23,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData | |||
| 			new GeneralDataMapper(), | ||||
| 			new InputDataMapper(), | ||||
| 			new SecurityDataMapper(), | ||||
| 			new ServiceDataMapper(), | ||||
| 			new UserInterfaceDataMapper() | ||||
| 		}; | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,154 @@ | |||
| /* | ||||
|  * Copyright (c) 2020 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/. | ||||
|  */ | ||||
| 
 | ||||
| using SafeExamBrowser.Settings; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping | ||||
| { | ||||
| 	internal class ServiceDataMapper : BaseDataMapper | ||||
| 	{ | ||||
| 		internal override void Map(string key, object value, AppSettings settings) | ||||
| 		{ | ||||
| 			switch (key) | ||||
| 			{ | ||||
| 				case Keys.Service.EnableChromeNotifications: | ||||
| 					MapEnableChromeNotifications(settings, value); | ||||
| 					break; | ||||
| 				case Keys.Service.EnableEaseOfAccessOptions: | ||||
| 					MapEnableEaseOfAccessOptions(settings, value); | ||||
| 					break; | ||||
| 				case Keys.Service.EnableNetworkOptions: | ||||
| 					MapEnableNetworkOptions(settings, value); | ||||
| 					break; | ||||
| 				case Keys.Service.EnablePasswordChange: | ||||
| 					MapEnablePasswordChange(settings, value); | ||||
| 					break; | ||||
| 				case Keys.Service.EnablePowerOptions: | ||||
| 					MapEnablePowerOptions(settings, value); | ||||
| 					break; | ||||
| 				case Keys.Service.EnableRemoteConnections: | ||||
| 					MapEnableRemoteConnections(settings, value); | ||||
| 					break; | ||||
| 				case Keys.Service.EnableSignout: | ||||
| 					MapEnableSignout(settings, value); | ||||
| 					break; | ||||
| 				case Keys.Service.EnableTaskManager: | ||||
| 					MapEnableTaskManager(settings, value); | ||||
| 					break; | ||||
| 				case Keys.Service.EnableUserLock: | ||||
| 					MapEnableUserLock(settings, value); | ||||
| 					break; | ||||
| 				case Keys.Service.EnableUserSwitch: | ||||
| 					MapEnableUserSwitch(settings, value); | ||||
| 					break; | ||||
| 				case Keys.Service.EnableVmWareOverlay: | ||||
| 					MapEnableVmWareOverlay(settings, value); | ||||
| 					break; | ||||
| 				case Keys.Service.EnableWindowsUpdate: | ||||
| 					MapEnableWindowsUpdate(settings, value); | ||||
| 					break; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		private void MapEnableChromeNotifications(AppSettings settings, object value) | ||||
| 		{ | ||||
| 			if (value is bool enable) | ||||
| 			{ | ||||
| 				settings.Service.DisableChromeNotifications = !enable; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		private void MapEnableEaseOfAccessOptions(AppSettings settings, object value) | ||||
| 		{ | ||||
| 			if (value is bool enable) | ||||
| 			{ | ||||
| 				settings.Service.DisableEaseOfAccessOptions = !enable; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		private void MapEnableNetworkOptions(AppSettings settings, object value) | ||||
| 		{ | ||||
| 			if (value is bool enable) | ||||
| 			{ | ||||
| 				settings.Service.DisableNetworkOptions = !enable; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		private void MapEnablePasswordChange(AppSettings settings, object value) | ||||
| 		{ | ||||
| 			if (value is bool enable) | ||||
| 			{ | ||||
| 				settings.Service.DisablePasswordChange = !enable; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		private void MapEnablePowerOptions(AppSettings settings, object value) | ||||
| 		{ | ||||
| 			if (value is bool enable) | ||||
| 			{ | ||||
| 				settings.Service.DisablePowerOptions = !enable; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		private void MapEnableRemoteConnections(AppSettings settings, object value) | ||||
| 		{ | ||||
| 			if (value is bool enable) | ||||
| 			{ | ||||
| 				settings.Service.DisableRemoteConnections = !enable; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		private void MapEnableSignout(AppSettings settings, object value) | ||||
| 		{ | ||||
| 			if (value is bool enable) | ||||
| 			{ | ||||
| 				settings.Service.DisableSignout = !enable; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		private void MapEnableTaskManager(AppSettings settings, object value) | ||||
| 		{ | ||||
| 			if (value is bool enable) | ||||
| 			{ | ||||
| 				settings.Service.DisableTaskManager = !enable; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		private void MapEnableUserLock(AppSettings settings, object value) | ||||
| 		{ | ||||
| 			if (value is bool enable) | ||||
| 			{ | ||||
| 				settings.Service.DisableUserLock = !enable; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		private void MapEnableUserSwitch(AppSettings settings, object value) | ||||
| 		{ | ||||
| 			if (value is bool enable) | ||||
| 			{ | ||||
| 				settings.Service.DisableUserSwitch = !enable; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		private void MapEnableVmWareOverlay(AppSettings settings, object value) | ||||
| 		{ | ||||
| 			if (value is bool enable) | ||||
| 			{ | ||||
| 				settings.Service.DisableVmwareOverlay = !enable; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		private void MapEnableWindowsUpdate(AppSettings settings, object value) | ||||
| 		{ | ||||
| 			if (value is bool enable) | ||||
| 			{ | ||||
| 				settings.Service.DisableWindowsUpdate = !enable; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -213,6 +213,22 @@ namespace SafeExamBrowser.Configuration.ConfigurationData | |||
| 			internal const string ServicePolicy = "sebServicePolicy"; | ||||
| 		} | ||||
| 
 | ||||
| 		internal static class Service | ||||
| 		{ | ||||
| 			internal const string EnableChromeNotifications = "enableChromeNotifications"; | ||||
| 			internal const string EnableEaseOfAccessOptions = "insideSebEnableEaseOfAccess"; | ||||
| 			internal const string EnableNetworkOptions = "insideSebEnableEnableNetworkConnectionSelector"; | ||||
| 			internal const string EnablePasswordChange = "insideSebEnableChangeAPassword"; | ||||
| 			internal const string EnablePowerOptions = "insideSebEnableShutDown"; | ||||
| 			internal const string EnableRemoteConnections = "allowScreenSharing"; | ||||
| 			internal const string EnableSignout = "insideSebEnableLogOff"; | ||||
| 			internal const string EnableTaskManager = "insideSebEnableStartTaskManager"; | ||||
| 			internal const string EnableUserLock = "insideSebEnableLockThisComputer"; | ||||
| 			internal const string EnableUserSwitch = "insideSebEnableSwitchUser"; | ||||
| 			internal const string EnableVmWareOverlay = "insideSebEnableVmWareClientShade"; | ||||
| 			internal const string EnableWindowsUpdate = "enableWindowsUpdate"; | ||||
| 		} | ||||
| 
 | ||||
| 		internal static class UserInterface | ||||
| 		{ | ||||
| 			internal const string ShowAudio = "audioControlEnabled"; | ||||
|  |  | |||
|  | @ -64,6 +64,7 @@ | |||
|     <Compile Include="ConfigurationData\DataMapping\BaseDataMapper.cs" /> | ||||
|     <Compile Include="ConfigurationData\DataMapping\InputDataMapper.cs" /> | ||||
|     <Compile Include="ConfigurationData\DataMapping\SecurityDataMapper.cs" /> | ||||
|     <Compile Include="ConfigurationData\DataMapping\ServiceDataMapper.cs" /> | ||||
|     <Compile Include="ConfigurationData\DataMapping\UserInterfaceDataMapper.cs" /> | ||||
|     <Compile Include="ConfigurationData\DataProcessor.cs" /> | ||||
|     <Compile Include="ConfigurationData\Keys.cs" /> | ||||
|  |  | |||
|  | @ -357,6 +357,8 @@ namespace SebWindowsConfig | |||
| 		public const String KeyLogDirectoryWin     = "logDirectoryWin"; | ||||
| 		public const String KeyAllowWLAN = "allowWlan"; | ||||
| 		public const String KeyLockOnMessageSocketClose = "lockOnMessageSocketClose"; | ||||
| 		public const String KeyAllowChromeNotifications = "enableChromeNotifications"; | ||||
| 		public const String KeyAllowWindowsUpdate = "enableWindowsUpdate"; | ||||
| 		// Group "macOS specific settings" | ||||
| 		public const String KeyMinMacOSVersion = "minMacOSVersion"; | ||||
| 		public const String KeyEnableAppSwitcherCheck = "enableAppSwitcherCheck"; | ||||
|  | @ -901,6 +903,8 @@ namespace SebWindowsConfig | |||
| 			SEBSettings.settingsDefault.Add(SEBSettings.KeyAllowDisplayMirroring, false); | ||||
| 			SEBSettings.settingsDefault.Add(SEBSettings.KeyAllowedDisplaysMaxNumber, 1); | ||||
| 			SEBSettings.settingsDefault.Add(SEBSettings.KeyAllowedDisplayBuiltin, true); | ||||
| 			SEBSettings.settingsDefault.Add(SEBSettings.KeyAllowChromeNotifications, false); | ||||
| 			SEBSettings.settingsDefault.Add(SEBSettings.KeyAllowWindowsUpdate, false); | ||||
| 
 | ||||
| 			// Default selected index and string in combo box for minMacOSVersion  | ||||
| 			SEBSettings.intArrayDefault[SEBSettings.ValMinMacOSVersion] = 4; | ||||
|  |  | |||
							
								
								
									
										2186
									
								
								SebWindowsConfig/SebWindowsConfigForm.Designer.cs
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										2186
									
								
								SebWindowsConfig/SebWindowsConfigForm.Designer.cs
									
										
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -763,6 +763,9 @@ namespace SebWindowsConfig | |||
| 			textBoxLogDirectoryWin.Text = (String)SEBSettings.settingsCurrent[SEBSettings.KeyLogDirectoryWin]; | ||||
| 			checkBoxAllowLogAccess.Checked = (Boolean)SEBSettings.settingsCurrent[SEBSettings.KeyAllowApplicationLog]; | ||||
| 			checkBoxShowLogButton.Checked = (Boolean)SEBSettings.settingsCurrent[SEBSettings.KeyShowApplicationLogButton]; | ||||
| 			checkBoxShowLogButton.Enabled = checkBoxAllowLogAccess.Checked; | ||||
| 			checkBoxAllowChromeNotifications.Checked = (Boolean)SEBSettings.settingsCurrent[SEBSettings.KeyAllowChromeNotifications]; | ||||
| 			checkBoxAllowWindowsUpdate.Checked = (Boolean)SEBSettings.settingsCurrent[SEBSettings.KeyAllowWindowsUpdate]; | ||||
| 
 | ||||
| 			if (String.IsNullOrEmpty(textBoxLogDirectoryWin.Text)) | ||||
| 			{ | ||||
|  | @ -4520,5 +4523,15 @@ namespace SebWindowsConfig | |||
| 		{ | ||||
| 			SEBSettings.settingsCurrent[SEBSettings.KeyShowApplicationLogButton] = checkBoxShowLogButton.Checked; | ||||
| 		} | ||||
| 
 | ||||
| 		private void checkBoxAllowChromeNotifications_CheckedChanged(object sender, EventArgs e) | ||||
| 		{ | ||||
| 			SEBSettings.settingsCurrent[SEBSettings.KeyAllowChromeNotifications] = checkBoxAllowChromeNotifications.Checked; | ||||
| 		} | ||||
| 
 | ||||
| 		private void checkBoxAllowWindowsUpdate_CheckedChanged(object sender, EventArgs e) | ||||
| 		{ | ||||
| 			SEBSettings.settingsCurrent[SEBSettings.KeyAllowWindowsUpdate] = checkBoxAllowWindowsUpdate.Checked; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Damian Büchel
						Damian Büchel