SEBWIN-451: Implemented dynamic reconfiguration for proctoring.

This commit is contained in:
Damian Büchel 2021-04-12 15:59:42 +02:00
parent 55603f3221
commit 8d5560d3c4
5 changed files with 16 additions and 12 deletions

View file

@ -117,21 +117,25 @@ namespace SafeExamBrowser.Proctoring
settings.JitsiMeet.ServerUrl = serverUrl.Replace(Uri.UriSchemeHttps, "").Replace(Uri.UriSchemeHttp, "").Replace(Uri.SchemeDelimiter, ""); settings.JitsiMeet.ServerUrl = serverUrl.Replace(Uri.UriSchemeHttps, "").Replace(Uri.UriSchemeHttp, "").Replace(Uri.SchemeDelimiter, "");
settings.JitsiMeet.Token = token; settings.JitsiMeet.Token = token;
if (window != default(IProctoringWindow)) StopProctoring();
{
StopProctoring();
}
StartProctoring(); StartProctoring();
} }
private void Server_ProctoringConfigurationReceived(bool enableChat, bool receiveAudio, bool receiveVideo) private void Server_ProctoringConfigurationReceived(bool allowChat, bool receiveAudio, bool receiveVideo)
{ {
logger.Info("Proctoring configuration received."); logger.Info("Proctoring configuration received.");
// TODO: How to set these things dynamically?!? settings.JitsiMeet.AllowChat = allowChat;
settings.JitsiMeet.ReceiveAudio = receiveAudio;
settings.JitsiMeet.ReceiveVideo = receiveVideo;
control.ExecuteScriptAsync("api.executeCommand('toggleChat');"); if (allowChat || receiveVideo)
{
settings.WindowVisibility = WindowVisibility.AllowToHide;
}
StopProctoring();
StartProctoring();
} }
private void StartProctoring() private void StartProctoring()

View file

@ -11,5 +11,5 @@ namespace SafeExamBrowser.Server.Contracts.Events
/// <summary> /// <summary>
/// Event handler used to indicate that proctoring configuration data has been received. /// Event handler used to indicate that proctoring configuration data has been received.
/// </summary> /// </summary>
public delegate void ProctoringConfigurationReceivedEventHandler(bool enableChat, bool receiveAudio, bool receiveVideo); public delegate void ProctoringConfigurationReceivedEventHandler(bool allowChat, bool receiveAudio, bool receiveVideo);
} }

View file

@ -10,7 +10,7 @@ namespace SafeExamBrowser.Server.Data
{ {
internal class Attributes internal class Attributes
{ {
public bool EnableChat { get; set; } public bool AllowChat { get; set; }
public bool ReceiveAudio { get; set; } public bool ReceiveAudio { get; set; }
public bool ReceiveVideo { get; set; } public bool ReceiveVideo { get; set; }
public string RoomName { get; set; } public string RoomName { get; set; }

View file

@ -169,7 +169,7 @@ namespace SafeExamBrowser.Server
attributes.Token = attributesJson["jitsiMeetToken"].Value<string>(); attributes.Token = attributesJson["jitsiMeetToken"].Value<string>();
break; break;
case Instructions.PROCTORING_RECONFIGURATION: case Instructions.PROCTORING_RECONFIGURATION:
attributes.EnableChat = attributesJson["jitsiMeetFeatureFlagChat"].Value<bool>(); attributes.AllowChat = attributesJson["jitsiMeetFeatureFlagChat"].Value<bool>();
attributes.ReceiveAudio = attributesJson["jitsiMeetReceiveAudio"].Value<bool>(); attributes.ReceiveAudio = attributesJson["jitsiMeetReceiveAudio"].Value<bool>();
attributes.ReceiveVideo = attributesJson["jitsiMeetReceiveVideo"].Value<bool>(); attributes.ReceiveVideo = attributesJson["jitsiMeetReceiveVideo"].Value<bool>();
break; break;

View file

@ -396,7 +396,7 @@ namespace SafeExamBrowser.Server
Task.Run(() => ProctoringInstructionReceived?.Invoke(attributes.RoomName, attributes.ServerUrl, attributes.Token)); Task.Run(() => ProctoringInstructionReceived?.Invoke(attributes.RoomName, attributes.ServerUrl, attributes.Token));
break; break;
case Instructions.PROCTORING_RECONFIGURATION: case Instructions.PROCTORING_RECONFIGURATION:
Task.Run(() => ProctoringConfigurationReceived?.Invoke(attributes.EnableChat, attributes.ReceiveAudio, attributes.ReceiveVideo)); Task.Run(() => ProctoringConfigurationReceived?.Invoke(attributes.AllowChat, attributes.ReceiveAudio, attributes.ReceiveVideo));
break; break;
case Instructions.QUIT: case Instructions.QUIT:
Task.Run(() => TerminationRequested?.Invoke()); Task.Run(() => TerminationRequested?.Invoke());