SEBWIN-931: Added missing default settings related to clipboard and ensured data processor is also executed with default settings.

This commit is contained in:
Damian Büchel 2024-08-19 12:19:32 +02:00
parent 1ff7d84375
commit 26f14f235d
5 changed files with 17 additions and 6 deletions

View file

@ -31,7 +31,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
new UserInterfaceDataMapper()
};
internal void MapRawDataToSettings(IDictionary<string, object> rawData, AppSettings settings)
internal void Map(IDictionary<string, object> rawData, AppSettings settings)
{
foreach (var item in rawData)
{

View file

@ -20,8 +20,13 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
{
internal void Process(IDictionary<string, object> rawData, AppSettings settings)
{
AllowBrowserToolbarForReloading(settings);
ProcessDefault(settings);
CalculateConfigurationKey(rawData, settings);
}
internal void ProcessDefault(AppSettings settings)
{
AllowBrowserToolbarForReloading(settings);
InitializeBrowserHomeFunctionality(settings);
InitializeClipboardSettings(settings);
InitializeProctoringSettings(settings);

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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;