SEBWIN-482 do not allow to reconfigure new SEB Server session

This commit is contained in:
anhefti 2022-03-16 11:45:06 +01:00
parent 01af8beedb
commit ab95995bf0
4 changed files with 38 additions and 2 deletions

View file

@ -119,6 +119,8 @@ namespace SafeExamBrowser.I18n.Contracts
MessageBox_ReloadConfirmationTitle, MessageBox_ReloadConfirmationTitle,
MessageBox_RemoteSessionNotAllowed, MessageBox_RemoteSessionNotAllowed,
MessageBox_RemoteSessionNotAllowedTitle, MessageBox_RemoteSessionNotAllowedTitle,
MessageBox_ServerReconfigurationWarning,
MessageBox_ServerReconfigurationWarningTitle,
MessageBox_ServiceUnavailableError, MessageBox_ServiceUnavailableError,
MessageBox_ServiceUnavailableErrorTitle, MessageBox_ServiceUnavailableErrorTitle,
MessageBox_ServiceUnavailableWarning, MessageBox_ServiceUnavailableWarning,

View file

@ -315,6 +315,12 @@
<Entry key="MessageBox_RemoteSessionNotAllowedTitle"> <Entry key="MessageBox_RemoteSessionNotAllowedTitle">
Remote-Sitzung erkannt Remote-Sitzung erkannt
</Entry> </Entry>
<Entry key="MessageBox_ServerReconfigurationWarning">
Es besteht bereits eine SEB Server Verbindung. Es kann keine andere SEB Server Verbindung aufgebaut werden.
</Entry>
<Entry key="MessageBox_ServerReconfigurationWarningTitle">
Rekonfiguration Nicht Erlaubt
</Entry>
<Entry key="MessageBox_ServiceUnavailableError"> <Entry key="MessageBox_ServiceUnavailableError">
Fehler beim Initialisieren des SEB-Service! SEB wird sich nun beenden da der Service als obligatorisch konfiguriert ist. Fehler beim Initialisieren des SEB-Service! SEB wird sich nun beenden da der Service als obligatorisch konfiguriert ist.
</Entry> </Entry>

View file

@ -315,6 +315,12 @@
<Entry key="MessageBox_RemoteSessionNotAllowedTitle"> <Entry key="MessageBox_RemoteSessionNotAllowedTitle">
Remote Session Detected Remote Session Detected
</Entry> </Entry>
<Entry key="MessageBox_ServerReconfigurationWarning">
There is already a SEB Server session running. It is not allowed to reconfigure for another SEB Server session.
</Entry>
<Entry key="MessageBox_ServerReconfigurationWarningTitle">
Reconfiguration Not Allowed
</Entry>
<Entry key="MessageBox_ServiceUnavailableError"> <Entry key="MessageBox_ServiceUnavailableError">
Failed to initialize the SEB service! SEB will now terminate since the service is configured to be mandatory. Failed to initialize the SEB service! SEB will now terminate since the service is configured to be mandatory.
</Entry> </Entry>

View file

@ -19,6 +19,7 @@ using SafeExamBrowser.Server.Contracts;
using SafeExamBrowser.Server.Contracts.Data; using SafeExamBrowser.Server.Contracts.Data;
using SafeExamBrowser.Settings; using SafeExamBrowser.Settings;
using SafeExamBrowser.SystemComponents.Contracts; using SafeExamBrowser.SystemComponents.Contracts;
using SafeExamBrowser.UserInterface.Contracts.MessageBox;
namespace SafeExamBrowser.Runtime.Operations namespace SafeExamBrowser.Runtime.Operations
{ {
@ -98,7 +99,15 @@ namespace SafeExamBrowser.Runtime.Operations
{ {
if (Context.Current.Settings.SessionMode == SessionMode.Server) 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) else if (Context.Next.Settings.SessionMode == SessionMode.Server)
{ {
@ -107,7 +116,6 @@ namespace SafeExamBrowser.Runtime.Operations
return OperationResult.Success; return OperationResult.Success;
} }
public override OperationResult Revert() public override OperationResult Revert()
{ {
var result = OperationResult.Success; var result = OperationResult.Success;
@ -256,5 +264,19 @@ namespace SafeExamBrowser.Runtime.Operations
return success; 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);
}
} }
} }