From 26f14f235d5d0243eb314a1de25eb35a498d4fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20B=C3=BCchel?= Date: Mon, 19 Aug 2024 12:19:32 +0200 Subject: [PATCH] SEBWIN-931: Added missing default settings related to clipboard and ensured data processor is also executed with default settings. --- .../ConfigurationData/DataMapper.cs | 2 +- .../ConfigurationData/DataProcessor.cs | 7 ++++++- .../ConfigurationData/DataValues.cs | 4 ++++ SafeExamBrowser.Configuration/ConfigurationRepository.cs | 4 +++- .../Operations/ConfigurationBaseOperation.cs | 6 +++--- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs index c39416f0..acdea08d 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs @@ -31,7 +31,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData new UserInterfaceDataMapper() }; - internal void MapRawDataToSettings(IDictionary rawData, AppSettings settings) + internal void Map(IDictionary rawData, AppSettings settings) { foreach (var item in rawData) { diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataProcessor.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataProcessor.cs index 61b84d98..cbeda46c 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataProcessor.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataProcessor.cs @@ -20,8 +20,13 @@ namespace SafeExamBrowser.Configuration.ConfigurationData { internal void Process(IDictionary rawData, AppSettings settings) { - AllowBrowserToolbarForReloading(settings); + ProcessDefault(settings); CalculateConfigurationKey(rawData, settings); + } + + internal void ProcessDefault(AppSettings settings) + { + AllowBrowserToolbarForReloading(settings); InitializeBrowserHomeFunctionality(settings); InitializeClipboardSettings(settings); InitializeProctoringSettings(settings); diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataValues.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataValues.cs index df5eb9f6..d161559a 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataValues.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataValues.cs @@ -196,6 +196,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData settings.Browser.ShowFileSystemElementPath = true; settings.Browser.StartUrl = "https://www.safeexambrowser.org/start"; settings.Browser.UseCustomUserAgent = false; + settings.Browser.UseIsolatedClipboard = true; settings.Browser.UseQueryParameter = false; settings.Browser.UseTemporaryDownAndUploadDirectory = false; @@ -209,7 +210,10 @@ namespace SafeExamBrowser.Configuration.ConfigurationData settings.Keyboard.AllowAltEsc = false; settings.Keyboard.AllowAltF4 = false; settings.Keyboard.AllowAltTab = true; + settings.Keyboard.AllowCtrlC = true; settings.Keyboard.AllowCtrlEsc = false; + settings.Keyboard.AllowCtrlV = true; + settings.Keyboard.AllowCtrlX = true; settings.Keyboard.AllowEsc = true; settings.Keyboard.AllowF1 = true; settings.Keyboard.AllowF2 = true; diff --git a/SafeExamBrowser.Configuration/ConfigurationRepository.cs b/SafeExamBrowser.Configuration/ConfigurationRepository.cs index a16dcc54..8c8475fa 100644 --- a/SafeExamBrowser.Configuration/ConfigurationRepository.cs +++ b/SafeExamBrowser.Configuration/ConfigurationRepository.cs @@ -122,6 +122,8 @@ namespace SafeExamBrowser.Configuration var status = default(LoadStatus); settings = LoadDefaultSettings(); + dataProcessor.ProcessDefault(settings); + logger.Info($"Initialized default settings, now attempting to load '{resource}'..."); try @@ -136,7 +138,7 @@ namespace SafeExamBrowser.Configuration if (status == LoadStatus.Success) { - dataMapper.MapRawDataToSettings(data, settings); + dataMapper.Map(data, settings); dataProcessor.Process(data, settings); } } diff --git a/SafeExamBrowser.Runtime/Operations/ConfigurationBaseOperation.cs b/SafeExamBrowser.Runtime/Operations/ConfigurationBaseOperation.cs index d7727b0d..eaa5956d 100644 --- a/SafeExamBrowser.Runtime/Operations/ConfigurationBaseOperation.cs +++ b/SafeExamBrowser.Runtime/Operations/ConfigurationBaseOperation.cs @@ -32,13 +32,13 @@ namespace SafeExamBrowser.Runtime.Operations protected abstract void InvokeActionRequired(ActionRequiredEventArgs args); - protected LoadStatus? TryLoadSettings(Uri uri, UriSource source, out PasswordParameters passwordParams, out AppSettings settings, string currentPassword = default(string)) + protected LoadStatus? TryLoadSettings(Uri uri, UriSource source, out PasswordParameters passwordParams, out AppSettings settings, string currentPassword = default) { passwordParams = new PasswordParameters { Password = string.Empty, IsHash = true }; var status = configuration.TryLoadSettings(uri, out settings, passwordParams); - if (status == LoadStatus.PasswordNeeded && currentPassword != default(string)) + if (status == LoadStatus.PasswordNeeded && currentPassword != default) { passwordParams.Password = currentPassword; passwordParams.IsHash = true; @@ -46,7 +46,7 @@ namespace SafeExamBrowser.Runtime.Operations status = configuration.TryLoadSettings(uri, out settings, passwordParams); } - for (int attempts = 0; attempts < 5 && status == LoadStatus.PasswordNeeded; attempts++) + for (var attempts = 0; attempts < 5 && status == LoadStatus.PasswordNeeded; attempts++) { var isLocalConfig = source == UriSource.AppData || source == UriSource.ProgramData; var purpose = isLocalConfig ? PasswordRequestPurpose.LocalSettings : PasswordRequestPurpose.Settings;