diff --git a/SafeExamBrowser.Runtime/CompositionRoot.cs b/SafeExamBrowser.Runtime/CompositionRoot.cs index f6b9a410..4174c9c3 100644 --- a/SafeExamBrowser.Runtime/CompositionRoot.cs +++ b/SafeExamBrowser.Runtime/CompositionRoot.cs @@ -90,6 +90,7 @@ namespace SafeExamBrowser.Runtime sessionOperations.Enqueue(new VirtualMachineOperation(vmDetector, logger, sessionContext)); sessionOperations.Enqueue(new ServiceOperation(logger, runtimeHost, serviceProxy, sessionContext, THIRTY_SECONDS, userInfo)); sessionOperations.Enqueue(new ClientTerminationOperation(logger, processFactory, proxyFactory, runtimeHost, sessionContext, THIRTY_SECONDS)); + sessionOperations.Enqueue(new ProctoringWorkaroundOperation(logger, sessionContext)); sessionOperations.Enqueue(new KioskModeOperation(desktopFactory, explorerShell, logger, processFactory, sessionContext)); sessionOperations.Enqueue(new ClientOperation(logger, processFactory, proxyFactory, runtimeHost, sessionContext, THIRTY_SECONDS)); sessionOperations.Enqueue(new SessionActivationOperation(logger, sessionContext)); diff --git a/SafeExamBrowser.Runtime/Operations/ProctoringWorkaroundOperation.cs b/SafeExamBrowser.Runtime/Operations/ProctoringWorkaroundOperation.cs new file mode 100644 index 00000000..10d1c3b1 --- /dev/null +++ b/SafeExamBrowser.Runtime/Operations/ProctoringWorkaroundOperation.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2021 ETH Zürich, Educational Development and Technology (LET) + * + * 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.Logging.Contracts; +using SafeExamBrowser.Settings.Security; + +namespace SafeExamBrowser.Runtime.Operations +{ + internal class ProctoringWorkaroundOperation : SessionOperation + { + private readonly ILogger logger; + + public override event ActionRequiredEventHandler ActionRequired { add { } remove { } } + public override event StatusChangedEventHandler StatusChanged { add { } remove { } } + + public ProctoringWorkaroundOperation(ILogger logger, SessionContext context) : base(context) + { + this.logger = logger; + } + + public override OperationResult Perform() + { + if (Context.Next.Settings.Proctoring.Enabled && Context.Next.Settings.Security.KioskMode == KioskMode.CreateNewDesktop) + { + Context.Next.Settings.Security.KioskMode = KioskMode.DisableExplorerShell; + logger.Info("Switched kiosk mode to Disable Explorer Shell due to remote proctoring being enabled."); + } + + return OperationResult.Success; + } + + public override OperationResult Repeat() + { + return Perform(); + } + + public override OperationResult Revert() + { + return OperationResult.Success; + } + } +} diff --git a/SafeExamBrowser.Runtime/SafeExamBrowser.Runtime.csproj b/SafeExamBrowser.Runtime/SafeExamBrowser.Runtime.csproj index 76c8f478..c6d616d8 100644 --- a/SafeExamBrowser.Runtime/SafeExamBrowser.Runtime.csproj +++ b/SafeExamBrowser.Runtime/SafeExamBrowser.Runtime.csproj @@ -104,6 +104,7 @@ +