From ab95995bf0c5344d9f8487c2ecb8a6c4a94f6323 Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 16 Mar 2022 11:45:06 +0100 Subject: [PATCH] SEBWIN-482 do not allow to reconfigure new SEB Server session --- SafeExamBrowser.I18n.Contracts/TextKey.cs | 2 ++ SafeExamBrowser.I18n/Data/de.xml | 6 +++++ SafeExamBrowser.I18n/Data/en.xml | 6 +++++ .../Operations/ServerOperation.cs | 26 +++++++++++++++++-- 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/SafeExamBrowser.I18n.Contracts/TextKey.cs b/SafeExamBrowser.I18n.Contracts/TextKey.cs index 85393ab7..caa74a9f 100644 --- a/SafeExamBrowser.I18n.Contracts/TextKey.cs +++ b/SafeExamBrowser.I18n.Contracts/TextKey.cs @@ -119,6 +119,8 @@ namespace SafeExamBrowser.I18n.Contracts MessageBox_ReloadConfirmationTitle, MessageBox_RemoteSessionNotAllowed, MessageBox_RemoteSessionNotAllowedTitle, + MessageBox_ServerReconfigurationWarning, + MessageBox_ServerReconfigurationWarningTitle, MessageBox_ServiceUnavailableError, MessageBox_ServiceUnavailableErrorTitle, MessageBox_ServiceUnavailableWarning, diff --git a/SafeExamBrowser.I18n/Data/de.xml b/SafeExamBrowser.I18n/Data/de.xml index 7057dfaa..e2dcd89d 100644 --- a/SafeExamBrowser.I18n/Data/de.xml +++ b/SafeExamBrowser.I18n/Data/de.xml @@ -315,6 +315,12 @@ Remote-Sitzung erkannt + + Es besteht bereits eine SEB Server Verbindung. Es kann keine andere SEB Server Verbindung aufgebaut werden. + + + Rekonfiguration Nicht Erlaubt + Fehler beim Initialisieren des SEB-Service! SEB wird sich nun beenden da der Service als obligatorisch konfiguriert ist. diff --git a/SafeExamBrowser.I18n/Data/en.xml b/SafeExamBrowser.I18n/Data/en.xml index 1df9527a..55bc1311 100644 --- a/SafeExamBrowser.I18n/Data/en.xml +++ b/SafeExamBrowser.I18n/Data/en.xml @@ -315,6 +315,12 @@ Remote Session Detected + + There is already a SEB Server session running. It is not allowed to reconfigure for another SEB Server session. + + + Reconfiguration Not Allowed + Failed to initialize the SEB service! SEB will now terminate since the service is configured to be mandatory. diff --git a/SafeExamBrowser.Runtime/Operations/ServerOperation.cs b/SafeExamBrowser.Runtime/Operations/ServerOperation.cs index b69dad6b..078f2c46 100644 --- a/SafeExamBrowser.Runtime/Operations/ServerOperation.cs +++ b/SafeExamBrowser.Runtime/Operations/ServerOperation.cs @@ -19,6 +19,7 @@ using SafeExamBrowser.Server.Contracts; using SafeExamBrowser.Server.Contracts.Data; using SafeExamBrowser.Settings; using SafeExamBrowser.SystemComponents.Contracts; +using SafeExamBrowser.UserInterface.Contracts.MessageBox; namespace SafeExamBrowser.Runtime.Operations { @@ -98,7 +99,15 @@ namespace SafeExamBrowser.Runtime.Operations { if (Context.Current.Settings.SessionMode == SessionMode.Server) { - InitializeNextSession(); + if (Context.Next.Settings.SessionMode == SessionMode.Server) + { + ShowReconfigurationError(); + return OperationResult.Aborted; + } + else + { + return Revert(); + } } else if (Context.Next.Settings.SessionMode == SessionMode.Server) { @@ -107,7 +116,6 @@ namespace SafeExamBrowser.Runtime.Operations return OperationResult.Success; } - public override OperationResult Revert() { var result = OperationResult.Success; @@ -256,5 +264,19 @@ namespace SafeExamBrowser.Runtime.Operations return success; } + + private void ShowReconfigurationError() + { + var args = new MessageEventArgs + { + Action = MessageBoxAction.Ok, + Icon = MessageBoxIcon.Warning, + Message = TextKey.MessageBox_ServerReconfigurationWarning, + Title = TextKey.MessageBox_ServerReconfigurationWarningTitle + }; + logger.Warn("Server reconfiguration requested but is not allowed."); + + ActionRequired?.Invoke(args); + } } }