From 1068efc384c31c178717411182bf3a2d7ed38db4 Mon Sep 17 00:00:00 2001 From: dbuechel Date: Wed, 23 Jan 2019 14:37:24 +0100 Subject: [PATCH] SEBWIN-226: Implemented mapping of download configuration. --- .../ConfigurationData/DataMapper.Browser.cs | 16 ++++++++++++++++ .../ConfigurationData/DataMapper.cs | 6 ++++++ .../ConfigurationData/DataValues.cs | 2 +- .../ConfigurationData/Keys.cs | 2 ++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.Browser.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.Browser.cs index 8faa8ba5..36b47f8a 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.Browser.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.Browser.cs @@ -13,6 +13,22 @@ namespace SafeExamBrowser.Configuration.ConfigurationData { internal partial class DataMapper { + private void MapAllowConfigurationDownloads(Settings settings, object value) + { + if (value is bool allow) + { + settings.Browser.AllowConfigurationDownloads = allow; + } + } + + private void MapAllowDownloads(Settings settings, object value) + { + if (value is bool allow) + { + settings.Browser.AllowDownloads = allow; + } + } + private void MapAllowNavigation(Settings settings, object value) { if (value is bool allow) diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs index 3b68b333..de77d027 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs @@ -27,6 +27,12 @@ namespace SafeExamBrowser.Configuration.ConfigurationData { switch (key) { + case Keys.Browser.AllowConfigurationDownloads: + MapAllowConfigurationDownloads(settings, value); + break; + case Keys.Browser.AllowDownloads: + MapAllowDownloads(settings, value); + break; case Keys.Browser.AllowNavigation: MapAllowNavigation(settings, value); break; diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataValues.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataValues.cs index 631baaf1..a9d93a4e 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataValues.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataValues.cs @@ -91,7 +91,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData settings.Browser.StartUrl = "https://www.safeexambrowser.org/start"; settings.Browser.AllowConfigurationDownloads = true; settings.Browser.AllowDeveloperConsole = false; - settings.Browser.AllowDownloads = false; + settings.Browser.AllowDownloads = true; settings.Browser.AllowPageZoom = true; settings.Browser.AllowPopups = true; settings.Browser.AdditionalWindowSettings.AllowAddressBar = false; diff --git a/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs b/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs index 52c0ed35..bad4d2ea 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs @@ -20,6 +20,8 @@ namespace SafeExamBrowser.Configuration.ConfigurationData internal static class Browser { + internal const string AllowConfigurationDownloads = "downloadAndOpenSebConfig"; + internal const string AllowDownloads = "allowDownUploads"; internal const string AllowNavigation = "allowBrowsingBackForward"; internal const string AllowNavigationAdditionalWindow = "newBrowserWindowNavigation"; internal const string AllowPageZoom = "enableZoomPage";