SEBWIN-329: Implemented new configuration keys to control access to log information during runtime.
This commit is contained in:
parent
8b0cc6db71
commit
b29828b724
12 changed files with 102 additions and 58 deletions
|
@ -6,6 +6,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using SafeExamBrowser.Contracts.Configuration.Settings;
|
using SafeExamBrowser.Contracts.Configuration.Settings;
|
||||||
using SafeExamBrowser.Contracts.Logging;
|
using SafeExamBrowser.Contracts.Logging;
|
||||||
|
|
||||||
|
@ -21,6 +22,26 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MapApplicationLogAccess(IDictionary<string, object> rawData, Settings settings)
|
||||||
|
{
|
||||||
|
var hasValue = rawData.TryGetValue(Keys.General.AllowApplicationLog, out var value);
|
||||||
|
|
||||||
|
if (hasValue && value is bool allow)
|
||||||
|
{
|
||||||
|
settings.AllowApplicationLogAccess = allow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.AllowApplicationLogAccess)
|
||||||
|
{
|
||||||
|
settings.ActionCenter.ShowApplicationLog = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
settings.ActionCenter.ShowApplicationLog = false;
|
||||||
|
settings.Taskbar.ShowApplicationLog = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void MapLogLevel(Settings settings, object value)
|
private void MapLogLevel(Settings settings, object value)
|
||||||
{
|
{
|
||||||
const int ERROR = 0, WARNING = 1, INFO = 2;
|
const int ERROR = 0, WARNING = 1, INFO = 2;
|
||||||
|
|
|
@ -12,11 +12,10 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
||||||
{
|
{
|
||||||
internal partial class DataMapper
|
internal partial class DataMapper
|
||||||
{
|
{
|
||||||
private void MapApplicationLog(Settings settings, object value)
|
private void MapApplicationLogButton(Settings settings, object value)
|
||||||
{
|
{
|
||||||
if (value is bool show)
|
if (value is bool show)
|
||||||
{
|
{
|
||||||
settings.ActionCenter.ShowApplicationLog = show;
|
|
||||||
settings.Taskbar.ShowApplicationLog = show;
|
settings.Taskbar.ShowApplicationLog = show;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
||||||
MapUserInterfaceSettings(item.Key, item.Value, settings);
|
MapUserInterfaceSettings(item.Key, item.Value, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MapApplicationLogAccess(rawData, settings);
|
||||||
MapKioskMode(rawData, settings);
|
MapKioskMode(rawData, settings);
|
||||||
MapUserAgentMode(rawData, settings);
|
MapUserAgentMode(rawData, settings);
|
||||||
}
|
}
|
||||||
|
@ -177,13 +178,10 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case Keys.UserInterface.AllowKeyboardLayout:
|
case Keys.UserInterface.ShowKeyboardLayout:
|
||||||
MapKeyboardLayout(settings, value);
|
MapKeyboardLayout(settings, value);
|
||||||
break;
|
break;
|
||||||
case Keys.UserInterface.AllowLog:
|
case Keys.UserInterface.ShowWirelessNetwork:
|
||||||
MapApplicationLog(settings, value);
|
|
||||||
break;
|
|
||||||
case Keys.UserInterface.AllowWirelessNetwork:
|
|
||||||
MapWirelessNetwork(settings, value);
|
MapWirelessNetwork(settings, value);
|
||||||
break;
|
break;
|
||||||
case Keys.UserInterface.ShowClock:
|
case Keys.UserInterface.ShowClock:
|
||||||
|
@ -192,6 +190,9 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
||||||
case Keys.UserInterface.UserInterfaceMode:
|
case Keys.UserInterface.UserInterfaceMode:
|
||||||
MapUserInterfaceMode(settings, value);
|
MapUserInterfaceMode(settings, value);
|
||||||
break;
|
break;
|
||||||
|
case Keys.UserInterface.Taskbar.ShowApplicationLog:
|
||||||
|
MapApplicationLogButton(settings, value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,6 +144,8 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
||||||
|
|
||||||
settings.ServicePolicy = ServicePolicy.Optional;
|
settings.ServicePolicy = ServicePolicy.Optional;
|
||||||
|
|
||||||
|
settings.AllowApplicationLogAccess = false;
|
||||||
|
|
||||||
settings.Taskbar.EnableTaskbar = true;
|
settings.Taskbar.EnableTaskbar = true;
|
||||||
settings.Taskbar.ShowApplicationInfo = false;
|
settings.Taskbar.ShowApplicationInfo = false;
|
||||||
settings.Taskbar.ShowApplicationLog = false;
|
settings.Taskbar.ShowApplicationLog = false;
|
||||||
|
|
|
@ -61,6 +61,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
||||||
internal static class General
|
internal static class General
|
||||||
{
|
{
|
||||||
internal const string AdminPasswordHash = "hashedAdminPassword";
|
internal const string AdminPasswordHash = "hashedAdminPassword";
|
||||||
|
internal const string AllowApplicationLog = "allowApplicationLog";
|
||||||
internal const string LogLevel = "logLevel";
|
internal const string LogLevel = "logLevel";
|
||||||
internal const string QuitPasswordHash = "hashedQuitPassword";
|
internal const string QuitPasswordHash = "hashedQuitPassword";
|
||||||
internal const string StartUrl = "startURL";
|
internal const string StartUrl = "startURL";
|
||||||
|
@ -119,11 +120,15 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
||||||
|
|
||||||
internal static class UserInterface
|
internal static class UserInterface
|
||||||
{
|
{
|
||||||
internal const string AllowKeyboardLayout = "showInputLanguage";
|
|
||||||
internal const string AllowLog = "showLogButton";
|
|
||||||
internal const string AllowWirelessNetwork = "allowWlan";
|
|
||||||
internal const string ShowClock = "showTime";
|
internal const string ShowClock = "showTime";
|
||||||
|
internal const string ShowKeyboardLayout = "showInputLanguage";
|
||||||
|
internal const string ShowWirelessNetwork = "allowWlan";
|
||||||
internal const string UserInterfaceMode = "touchOptimized";
|
internal const string UserInterfaceMode = "touchOptimized";
|
||||||
|
|
||||||
|
internal static class Taskbar
|
||||||
|
{
|
||||||
|
internal const string ShowApplicationLog = "showApplicationLogButton";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,15 +28,20 @@ namespace SafeExamBrowser.Contracts.Configuration.Settings
|
||||||
public string AdminPasswordHash { get; set; }
|
public string AdminPasswordHash { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The mode which determines the configuration behaviour.
|
/// Determines whether any log information will be accessible via the user interface.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ConfigurationMode ConfigurationMode { get; set; }
|
public bool AllowApplicationLogAccess { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All browser-related settings.
|
/// All browser-related settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BrowserSettings Browser { get; set; }
|
public BrowserSettings Browser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The mode which determines the configuration behaviour.
|
||||||
|
/// </summary>
|
||||||
|
public ConfigurationMode ConfigurationMode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All keyboard-related settings.
|
/// All keyboard-related settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -16,19 +16,19 @@ namespace SafeExamBrowser.Contracts.UserInterface.Windows
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IRuntimeWindow : ILogObserver, IProgressIndicator, IWindow
|
public interface IRuntimeWindow : ILogObserver, IProgressIndicator, IWindow
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the application log is visible.
|
||||||
|
/// </summary>
|
||||||
|
bool ShowLog { set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the progress bar is visible.
|
||||||
|
/// </summary>
|
||||||
|
bool ShowProgressBar { set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines whether the window will stay on top of other windows.
|
/// Determines whether the window will stay on top of other windows.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool TopMost { get; set; }
|
bool TopMost { set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Hides the progress bar.
|
|
||||||
/// </summary>
|
|
||||||
void HideProgressBar();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Shows the progress bar.
|
|
||||||
/// </summary>
|
|
||||||
void ShowProgressBar();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ namespace SafeExamBrowser.Runtime
|
||||||
{
|
{
|
||||||
runtimeWindow.Show();
|
runtimeWindow.Show();
|
||||||
runtimeWindow.BringToForeground();
|
runtimeWindow.BringToForeground();
|
||||||
runtimeWindow.ShowProgressBar();
|
runtimeWindow.ShowProgressBar = true;
|
||||||
logger.Info(AppendDivider("Session Start Procedure"));
|
logger.Info(AppendDivider("Session Start Procedure"));
|
||||||
|
|
||||||
if (SessionIsRunning)
|
if (SessionIsRunning)
|
||||||
|
@ -191,9 +191,10 @@ namespace SafeExamBrowser.Runtime
|
||||||
{
|
{
|
||||||
RegisterSessionEvents();
|
RegisterSessionEvents();
|
||||||
|
|
||||||
runtimeWindow.HideProgressBar();
|
runtimeWindow.ShowProgressBar = false;
|
||||||
runtimeWindow.UpdateStatus(TextKey.RuntimeWindow_ApplicationRunning);
|
runtimeWindow.ShowLog = Session.Settings.AllowApplicationLogAccess;
|
||||||
runtimeWindow.TopMost = Session.Settings.KioskMode != KioskMode.None;
|
runtimeWindow.TopMost = Session.Settings.KioskMode != KioskMode.None;
|
||||||
|
runtimeWindow.UpdateStatus(TextKey.RuntimeWindow_ApplicationRunning);
|
||||||
|
|
||||||
if (Session.Settings.KioskMode == KioskMode.DisableExplorerShell)
|
if (Session.Settings.KioskMode == KioskMode.DisableExplorerShell)
|
||||||
{
|
{
|
||||||
|
@ -222,7 +223,7 @@ namespace SafeExamBrowser.Runtime
|
||||||
{
|
{
|
||||||
if (SessionIsRunning)
|
if (SessionIsRunning)
|
||||||
{
|
{
|
||||||
runtimeWindow.HideProgressBar();
|
runtimeWindow.ShowProgressBar = false;
|
||||||
runtimeWindow.UpdateStatus(TextKey.RuntimeWindow_ApplicationRunning);
|
runtimeWindow.UpdateStatus(TextKey.RuntimeWindow_ApplicationRunning);
|
||||||
runtimeWindow.TopMost = Session.Settings.KioskMode != KioskMode.None;
|
runtimeWindow.TopMost = Session.Settings.KioskMode != KioskMode.None;
|
||||||
|
|
||||||
|
@ -237,7 +238,7 @@ namespace SafeExamBrowser.Runtime
|
||||||
{
|
{
|
||||||
runtimeWindow.Show();
|
runtimeWindow.Show();
|
||||||
runtimeWindow.BringToForeground();
|
runtimeWindow.BringToForeground();
|
||||||
runtimeWindow.ShowProgressBar();
|
runtimeWindow.ShowProgressBar = true;
|
||||||
logger.Info(AppendDivider("Session Stop Procedure"));
|
logger.Info(AppendDivider("Session Stop Procedure"));
|
||||||
|
|
||||||
DeregisterSessionEvents();
|
DeregisterSessionEvents();
|
||||||
|
|
|
@ -54,7 +54,8 @@
|
||||||
<TextBlock x:Name="StatusTextBlock" Grid.Row="1" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center"
|
<TextBlock x:Name="StatusTextBlock" Grid.Row="1" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center"
|
||||||
Text="{Binding Status}" VerticalAlignment="Center" />
|
Text="{Binding Status}" VerticalAlignment="Center" />
|
||||||
<Border Grid.Row="2" BorderBrush="DodgerBlue" BorderThickness="0,0.5,0,0">
|
<Border Grid.Row="2" BorderBrush="DodgerBlue" BorderThickness="0,0.5,0,0">
|
||||||
<ScrollViewer x:Name="LogScrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0,10,0,0" Template="{StaticResource SmallBarScrollViewer}">
|
<ScrollViewer x:Name="LogScrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0,10,0,0"
|
||||||
|
Template="{StaticResource SmallBarScrollViewer}" Visibility="Collapsed">
|
||||||
<TextBlock x:Name="LogTextBlock" Background="Transparent" FontFamily="Consolas" FontSize="10" />
|
<TextBlock x:Name="LogTextBlock" Background="Transparent" FontFamily="Consolas" FontSize="10" />
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
|
@ -25,10 +25,26 @@ namespace SafeExamBrowser.UserInterface.Desktop
|
||||||
private RuntimeWindowViewModel model;
|
private RuntimeWindowViewModel model;
|
||||||
private WindowClosingEventHandler closing;
|
private WindowClosingEventHandler closing;
|
||||||
|
|
||||||
|
public bool ShowLog
|
||||||
|
{
|
||||||
|
set => Dispatcher.Invoke(() => LogScrollViewer.Visibility = value ? Visibility.Visible : Visibility.Collapsed);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IRuntimeWindow.ShowProgressBar
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
model.AnimatedBorderVisibility = value ? Visibility.Hidden : Visibility.Visible;
|
||||||
|
model.ProgressBarVisibility = value ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool TopMost
|
public bool TopMost
|
||||||
{
|
{
|
||||||
get { return Dispatcher.Invoke(() => Topmost); }
|
set => Dispatcher.Invoke(() => Topmost = value);
|
||||||
set { Dispatcher.Invoke(() => Topmost = value); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event WindowClosingEventHandler IWindow.Closing
|
event WindowClosingEventHandler IWindow.Closing
|
||||||
|
@ -67,12 +83,6 @@ namespace SafeExamBrowser.UserInterface.Desktop
|
||||||
Dispatcher.Invoke(base.Hide);
|
Dispatcher.Invoke(base.Hide);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HideProgressBar()
|
|
||||||
{
|
|
||||||
model.AnimatedBorderVisibility = Visibility.Visible;
|
|
||||||
model.ProgressBarVisibility = Visibility.Hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Notify(ILogContent content)
|
public void Notify(ILogContent content)
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
|
@ -107,12 +117,6 @@ namespace SafeExamBrowser.UserInterface.Desktop
|
||||||
model.CurrentProgress = value;
|
model.CurrentProgress = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowProgressBar()
|
|
||||||
{
|
|
||||||
model.AnimatedBorderVisibility = Visibility.Hidden;
|
|
||||||
model.ProgressBarVisibility = Visibility.Visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateStatus(TextKey key, bool busyIndication = false)
|
public void UpdateStatus(TextKey key, bool busyIndication = false)
|
||||||
{
|
{
|
||||||
model.Status = text.Get(key);
|
model.Status = text.Get(key);
|
||||||
|
|
|
@ -54,7 +54,8 @@
|
||||||
<TextBlock x:Name="StatusTextBlock" Grid.Row="1" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center"
|
<TextBlock x:Name="StatusTextBlock" Grid.Row="1" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center"
|
||||||
Text="{Binding Status}" VerticalAlignment="Center" />
|
Text="{Binding Status}" VerticalAlignment="Center" />
|
||||||
<Border Grid.Row="2" BorderBrush="DodgerBlue" BorderThickness="0,0.5,0,0">
|
<Border Grid.Row="2" BorderBrush="DodgerBlue" BorderThickness="0,0.5,0,0">
|
||||||
<ScrollViewer x:Name="LogScrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0,10,0,0" Template="{StaticResource SmallBarScrollViewer}">
|
<ScrollViewer x:Name="LogScrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0,10,0,0"
|
||||||
|
Template="{StaticResource SmallBarScrollViewer}" Visibility="Collapsed">
|
||||||
<TextBlock x:Name="LogTextBlock" Background="Transparent" FontFamily="Consolas" FontSize="10" />
|
<TextBlock x:Name="LogTextBlock" Background="Transparent" FontFamily="Consolas" FontSize="10" />
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
|
@ -25,10 +25,26 @@ namespace SafeExamBrowser.UserInterface.Mobile
|
||||||
private RuntimeWindowViewModel model;
|
private RuntimeWindowViewModel model;
|
||||||
private WindowClosingEventHandler closing;
|
private WindowClosingEventHandler closing;
|
||||||
|
|
||||||
|
public bool ShowLog
|
||||||
|
{
|
||||||
|
set => Dispatcher.Invoke(() => LogScrollViewer.Visibility = value ? Visibility.Visible : Visibility.Collapsed);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IRuntimeWindow.ShowProgressBar
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
model.AnimatedBorderVisibility = value ? Visibility.Hidden : Visibility.Visible;
|
||||||
|
model.ProgressBarVisibility = value ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool TopMost
|
public bool TopMost
|
||||||
{
|
{
|
||||||
get { return Dispatcher.Invoke(() => Topmost); }
|
set => Dispatcher.Invoke(() => Topmost = value);
|
||||||
set { Dispatcher.Invoke(() => Topmost = value); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event WindowClosingEventHandler IWindow.Closing
|
event WindowClosingEventHandler IWindow.Closing
|
||||||
|
@ -67,12 +83,6 @@ namespace SafeExamBrowser.UserInterface.Mobile
|
||||||
Dispatcher.Invoke(base.Hide);
|
Dispatcher.Invoke(base.Hide);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HideProgressBar()
|
|
||||||
{
|
|
||||||
model.AnimatedBorderVisibility = Visibility.Visible;
|
|
||||||
model.ProgressBarVisibility = Visibility.Hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Notify(ILogContent content)
|
public void Notify(ILogContent content)
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
|
@ -107,12 +117,6 @@ namespace SafeExamBrowser.UserInterface.Mobile
|
||||||
model.CurrentProgress = value;
|
model.CurrentProgress = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowProgressBar()
|
|
||||||
{
|
|
||||||
model.AnimatedBorderVisibility = Visibility.Hidden;
|
|
||||||
model.ProgressBarVisibility = Visibility.Visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateStatus(TextKey key, bool busyIndication = false)
|
public void UpdateStatus(TextKey key, bool busyIndication = false)
|
||||||
{
|
{
|
||||||
model.Status = text.Get(key);
|
model.Status = text.Get(key);
|
||||||
|
|
Loading…
Reference in a new issue