Update Safe Exam Browser Patch to 3.10.0.826
This commit is contained in:
@@ -16,12 +16,7 @@ namespace SafeExamBrowser.Client.Operations
|
||||
/// </summary>
|
||||
internal abstract class ClientOperation : IOperation
|
||||
{
|
||||
protected ClientContext Context { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// TODO: In case this event is neither used by the runtime, either remove it completely or then move it to a separate interface!
|
||||
/// </summary>
|
||||
public event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
protected ClientContext Context { get; }
|
||||
|
||||
public abstract event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
|
60
SafeExamBrowser.Client/Operations/PermissionOperation.cs
Normal file
60
SafeExamBrowser.Client/Operations/PermissionOperation.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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 SafeExamBrowser.Core.Contracts.OperationModel;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.SystemComponents.Contracts.Network;
|
||||
|
||||
namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class PermissionOperation : ClientOperation
|
||||
{
|
||||
private readonly ILogger logger;
|
||||
private readonly INetworkAdapter networkAdapter;
|
||||
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public PermissionOperation(ClientContext context, ILogger logger, INetworkAdapter networkAdapter) : base(context)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.networkAdapter = networkAdapter;
|
||||
}
|
||||
|
||||
public override OperationResult Perform()
|
||||
{
|
||||
logger.Info("Initializing permissions...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_InitializePermissions);
|
||||
|
||||
RequestNetworkAdapterAccess();
|
||||
|
||||
return OperationResult.Success;
|
||||
}
|
||||
|
||||
public override OperationResult Revert()
|
||||
{
|
||||
return OperationResult.Success;
|
||||
}
|
||||
|
||||
private void RequestNetworkAdapterAccess()
|
||||
{
|
||||
var granted = networkAdapter.RequestAccess();
|
||||
|
||||
if (granted)
|
||||
{
|
||||
logger.Info("Permission to access the wireless networking functionality has been granted.");
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Warn("Permission to access the wireless networking functionality has not been granted! " +
|
||||
"If required, please grant the location permission manually under 'Privacy & Security' in the system settings.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -11,7 +11,6 @@ using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.Proctoring.Contracts;
|
||||
using SafeExamBrowser.Settings;
|
||||
using SafeExamBrowser.UserInterface.Contracts;
|
||||
using SafeExamBrowser.UserInterface.Contracts.Shell;
|
||||
|
||||
@@ -51,12 +50,6 @@ namespace SafeExamBrowser.Client.Operations
|
||||
|
||||
controller.Initialize(Context.Settings.Proctoring);
|
||||
|
||||
if (Context.Settings.SessionMode == SessionMode.Server && Context.Settings.Proctoring.ShowRaiseHandNotification)
|
||||
{
|
||||
actionCenter.AddNotificationControl(uiFactory.CreateRaiseHandControl(controller, Location.ActionCenter, Context.Settings.Proctoring));
|
||||
taskbar.AddNotificationControl(uiFactory.CreateRaiseHandControl(controller, Location.Taskbar, Context.Settings.Proctoring));
|
||||
}
|
||||
|
||||
foreach (var notification in controller.Notifications)
|
||||
{
|
||||
actionCenter.AddNotificationControl(uiFactory.CreateNotificationControl(notification, Location.ActionCenter));
|
||||
|
@@ -12,20 +12,37 @@ using SafeExamBrowser.I18n.Contracts;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.Server.Contracts;
|
||||
using SafeExamBrowser.Settings;
|
||||
using SafeExamBrowser.UserInterface.Contracts;
|
||||
using SafeExamBrowser.UserInterface.Contracts.Shell;
|
||||
|
||||
namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class ServerOperation : ClientOperation
|
||||
{
|
||||
private readonly IActionCenter actionCenter;
|
||||
private readonly IInvigilator invigilator;
|
||||
private readonly ILogger logger;
|
||||
private readonly IServerProxy server;
|
||||
private readonly ITaskbar taskbar;
|
||||
private readonly IUserInterfaceFactory uiFactory;
|
||||
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public ServerOperation(ClientContext context, ILogger logger, IServerProxy server) : base(context)
|
||||
public ServerOperation(
|
||||
IActionCenter actionCenter,
|
||||
ClientContext context,
|
||||
IInvigilator invigilator,
|
||||
ILogger logger,
|
||||
IServerProxy server,
|
||||
ITaskbar taskbar,
|
||||
IUserInterfaceFactory uiFactory) : base(context)
|
||||
{
|
||||
this.actionCenter = actionCenter;
|
||||
this.invigilator = invigilator;
|
||||
this.logger = logger;
|
||||
this.server = server;
|
||||
this.taskbar = taskbar;
|
||||
this.uiFactory = uiFactory;
|
||||
}
|
||||
|
||||
public override OperationResult Perform()
|
||||
@@ -42,6 +59,14 @@ namespace SafeExamBrowser.Client.Operations
|
||||
Context.AppConfig.ServerOauth2Token,
|
||||
Context.Settings.Server);
|
||||
server.StartConnectivity();
|
||||
|
||||
if (Context.Settings.Server.Invigilation.ShowRaiseHandNotification)
|
||||
{
|
||||
invigilator.Initialize(Context.Settings.Server.Invigilation);
|
||||
|
||||
actionCenter.AddNotificationControl(uiFactory.CreateRaiseHandControl(invigilator, Location.ActionCenter, Context.Settings.Server.Invigilation));
|
||||
taskbar.AddNotificationControl(uiFactory.CreateRaiseHandControl(invigilator, Location.Taskbar, Context.Settings.Server.Invigilation));
|
||||
}
|
||||
}
|
||||
|
||||
return OperationResult.Success;
|
||||
|
@@ -83,7 +83,7 @@ namespace SafeExamBrowser.Client.Operations
|
||||
InitializeSystemComponents();
|
||||
InitializeActionCenter();
|
||||
InitializeTaskbar();
|
||||
InitializeTaskview();
|
||||
//InitializeTaskview();
|
||||
InitializeActivators();
|
||||
InitializeAlwaysOnState();
|
||||
|
||||
@@ -112,11 +112,11 @@ namespace SafeExamBrowser.Client.Operations
|
||||
actionCenterActivator.Start();
|
||||
}
|
||||
|
||||
if (Context.Settings.Keyboard.AllowAltTab && activator is ITaskviewActivator taskViewActivator)
|
||||
{
|
||||
taskview.Register(taskViewActivator);
|
||||
taskViewActivator.Start();
|
||||
}
|
||||
//if (Context.Settings.Keyboard.AllowAltTab && activator is ITaskviewActivator taskViewActivator)
|
||||
//{
|
||||
// taskview.Register(taskViewActivator);
|
||||
// taskViewActivator.Start();
|
||||
//}
|
||||
|
||||
if (Context.Settings.Security.AllowTermination && activator is ITerminationActivator terminationActivator)
|
||||
{
|
||||
|
54
SafeExamBrowser.Client/Operations/WindowGuardOperation.cs
Normal file
54
SafeExamBrowser.Client/Operations/WindowGuardOperation.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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 SafeExamBrowser.Core.Contracts.OperationModel;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.UserInterface.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class WindowGuardOperation : ClientOperation
|
||||
{
|
||||
private readonly ILogger logger;
|
||||
private readonly IWindowGuard guard;
|
||||
|
||||
public WindowGuardOperation(ClientContext context, ILogger logger, IWindowGuard guard) : base(context)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.guard = guard;
|
||||
}
|
||||
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public override OperationResult Perform()
|
||||
{
|
||||
logger.Info("Initializing window guard...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_InitializeWindowGuard);
|
||||
|
||||
if (Context.Settings.Proctoring.Enabled || Context.Settings.Security.AllowWindowCapture)
|
||||
{
|
||||
guard.Deactivate();
|
||||
logger.Info($"Deactivated window guard because {(Context.Settings.Proctoring.Enabled ? "proctoring" : "window capturing")} is enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
guard.Activate();
|
||||
logger.Info("Activated window guard.");
|
||||
}
|
||||
|
||||
return OperationResult.Success;
|
||||
}
|
||||
|
||||
public override OperationResult Revert()
|
||||
{
|
||||
return OperationResult.Success;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user