SEBWIN-448: Added configuration scaffolding for remote proctoring.
This commit is contained in:
		
							parent
							
								
									b27bf24eea
								
							
						
					
					
						commit
						d113d59223
					
				
					 8 changed files with 90 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -22,6 +22,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
 | 
			
		|||
			new ConfigurationFileDataMapper(),
 | 
			
		||||
			new GeneralDataMapper(),
 | 
			
		||||
			new InputDataMapper(),
 | 
			
		||||
			new ProctoringDataMapper(),
 | 
			
		||||
			new SecurityDataMapper(),
 | 
			
		||||
			new ServerDataMapper(),
 | 
			
		||||
			new ServiceDataMapper(),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using SafeExamBrowser.Settings;
 | 
			
		||||
 | 
			
		||||
namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
 | 
			
		||||
{
 | 
			
		||||
	internal class ProctoringDataMapper : BaseDataMapper
 | 
			
		||||
	{
 | 
			
		||||
		internal override void Map(string key, object value, AppSettings settings)
 | 
			
		||||
		{
 | 
			
		||||
			switch (key)
 | 
			
		||||
			{
 | 
			
		||||
				// TODO
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		internal override void MapGlobal(IDictionary<string, object> rawData, AppSettings settings)
 | 
			
		||||
		{
 | 
			
		||||
			MapProctoringEnabled(rawData, settings);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		private void MapProctoringEnabled(IDictionary<string, object> rawData, AppSettings settings)
 | 
			
		||||
		{
 | 
			
		||||
			var jitsiEnabled = rawData.TryGetValue(Keys.Proctoring.JitsiMeet.Enabled, out var v) && v is bool b && b;
 | 
			
		||||
			var zoomEnabled = rawData.TryGetValue(Keys.Proctoring.Zoom.Enabled, out v) && v is bool b2 && b2;
 | 
			
		||||
 | 
			
		||||
			settings.Proctoring.Enabled = jitsiEnabled || zoomEnabled;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -214,18 +214,16 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
 | 
			
		|||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		internal static class RemoteProctoring
 | 
			
		||||
		internal static class Proctoring
 | 
			
		||||
		{
 | 
			
		||||
			internal const string Enabled = "jitsiMeetEnable";
 | 
			
		||||
 | 
			
		||||
			internal static class JitsiMeet
 | 
			
		||||
			{
 | 
			
		||||
 | 
			
		||||
				internal const string Enabled = "jitsiMeetEnable";
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			internal static class Zoom
 | 
			
		||||
			{
 | 
			
		||||
 | 
			
		||||
				internal const string Enabled = "zoomEnable";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -63,6 +63,7 @@
 | 
			
		|||
    <Compile Include="ConfigurationData\DataMapping\GeneralDataMapper.cs" />
 | 
			
		||||
    <Compile Include="ConfigurationData\DataMapping\BaseDataMapper.cs" />
 | 
			
		||||
    <Compile Include="ConfigurationData\DataMapping\InputDataMapper.cs" />
 | 
			
		||||
    <Compile Include="ConfigurationData\DataMapping\ProctoringDataMapper.cs" />
 | 
			
		||||
    <Compile Include="ConfigurationData\DataMapping\SecurityDataMapper.cs" />
 | 
			
		||||
    <Compile Include="ConfigurationData\DataMapping\ServerDataMapper.cs" />
 | 
			
		||||
    <Compile Include="ConfigurationData\DataMapping\ServiceDataMapper.cs" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,15 +28,29 @@ namespace SafeExamBrowser.Runtime.Operations
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		public override OperationResult Perform()
 | 
			
		||||
		{
 | 
			
		||||
			if (Context.Next.Settings.Proctoring.Enabled)
 | 
			
		||||
			{
 | 
			
		||||
				return ShowDisclaimer();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			logger.Info("Remote proctoring is disabled, skipping disclaimer.");
 | 
			
		||||
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public override OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			if (Context.Next.Settings.Proctoring.Enabled)
 | 
			
		||||
			{
 | 
			
		||||
				return ShowDisclaimer();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			logger.Info("Remote proctoring is disabled, skipping disclaimer.");
 | 
			
		||||
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public override OperationResult Revert()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,7 @@ using SafeExamBrowser.Settings.Applications;
 | 
			
		|||
using SafeExamBrowser.Settings.Browser;
 | 
			
		||||
using SafeExamBrowser.Settings.Logging;
 | 
			
		||||
using SafeExamBrowser.Settings.Monitoring;
 | 
			
		||||
using SafeExamBrowser.Settings.Proctoring;
 | 
			
		||||
using SafeExamBrowser.Settings.Security;
 | 
			
		||||
using SafeExamBrowser.Settings.Server;
 | 
			
		||||
using SafeExamBrowser.Settings.Service;
 | 
			
		||||
| 
						 | 
				
			
			@ -65,6 +66,11 @@ namespace SafeExamBrowser.Settings
 | 
			
		|||
		/// </summary>
 | 
			
		||||
		public MouseSettings Mouse { get; set; }
 | 
			
		||||
 | 
			
		||||
		/// <summary>
 | 
			
		||||
		/// All proctoring-related settings.
 | 
			
		||||
		/// </summary>
 | 
			
		||||
		public ProctoringSettings Proctoring { get; set; }
 | 
			
		||||
 | 
			
		||||
		/// <summary>
 | 
			
		||||
		/// All security-related settings.
 | 
			
		||||
		/// </summary>
 | 
			
		||||
| 
						 | 
				
			
			@ -103,6 +109,7 @@ namespace SafeExamBrowser.Settings
 | 
			
		|||
			Browser = new BrowserSettings();
 | 
			
		||||
			Keyboard = new KeyboardSettings();
 | 
			
		||||
			Mouse = new MouseSettings();
 | 
			
		||||
			Proctoring = new ProctoringSettings();
 | 
			
		||||
			Security = new SecuritySettings();
 | 
			
		||||
			Server = new ServerSettings();
 | 
			
		||||
			Service = new ServiceSettings();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										24
									
								
								SafeExamBrowser.Settings/Proctoring/ProctoringSettings.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								SafeExamBrowser.Settings/Proctoring/ProctoringSettings.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace SafeExamBrowser.Settings.Proctoring
 | 
			
		||||
{
 | 
			
		||||
	/// <summary>
 | 
			
		||||
	/// Defines all settings related to remote proctoring.
 | 
			
		||||
	/// </summary>
 | 
			
		||||
	[Serializable]
 | 
			
		||||
	public class ProctoringSettings
 | 
			
		||||
	{
 | 
			
		||||
		/// <summary>
 | 
			
		||||
		/// Determines whether the entire remote proctoring feature is enabled.
 | 
			
		||||
		/// </summary>
 | 
			
		||||
		public bool Enabled { get; set; }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -71,6 +71,7 @@
 | 
			
		|||
    <Compile Include="Browser\Proxy\ProxyProtocol.cs" />
 | 
			
		||||
    <Compile Include="Browser\Proxy\ProxyConfiguration.cs" />
 | 
			
		||||
    <Compile Include="ConfigurationMode.cs" />
 | 
			
		||||
    <Compile Include="Proctoring\ProctoringSettings.cs" />
 | 
			
		||||
    <Compile Include="SessionMode.cs" />
 | 
			
		||||
    <Compile Include="Security\KioskMode.cs" />
 | 
			
		||||
    <Compile Include="Logging\LogLevel.cs" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue