diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/ProctoringDataMapper.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/ProctoringDataMapper.cs index e35a10f7..b86cd786 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/ProctoringDataMapper.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/ProctoringDataMapper.cs @@ -77,9 +77,24 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping case Keys.Proctoring.WindowVisibility: MapWindowVisibility(settings, value); break; + case Keys.Proctoring.Zoom.ApiKey: + MapZoomApiKey(settings, value); + break; + case Keys.Proctoring.Zoom.ApiSecret: + MapZoomApiSecret(settings, value); + break; case Keys.Proctoring.Zoom.Enabled: MapZoomEnabled(settings, value); break; + case Keys.Proctoring.Zoom.MeetingNumber: + MapZoomMeetingNumber(settings, value); + break; + case Keys.Proctoring.Zoom.Signature: + MapZoomSignature(settings, value); + break; + case Keys.Proctoring.Zoom.UserName: + MapZoomUserName(settings, value); + break; } } @@ -262,6 +277,22 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping } } + private void MapZoomApiKey(AppSettings settings, object value) + { + if (value is string key) + { + settings.Proctoring.Zoom.ApiKey = key; + } + } + + private void MapZoomApiSecret(AppSettings settings, object value) + { + if (value is string secret) + { + settings.Proctoring.Zoom.ApiSecret = secret; + } + } + private void MapZoomEnabled(AppSettings settings, object value) { if (value is bool enabled) @@ -269,5 +300,29 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping settings.Proctoring.Zoom.Enabled = enabled; } } + + private void MapZoomMeetingNumber(AppSettings settings, object value) + { + if (value is string number) + { + settings.Proctoring.Zoom.MeetingNumber = number; + } + } + + private void MapZoomSignature(AppSettings settings, object value) + { + if (value is string signature) + { + settings.Proctoring.Zoom.Signature = signature; + } + } + + private void MapZoomUserName(AppSettings settings, object value) + { + if (value is string name) + { + settings.Proctoring.Zoom.UserName = name; + } + } } } diff --git a/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs b/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs index 7f728b6b..2cfb0b87 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs @@ -250,7 +250,12 @@ namespace SafeExamBrowser.Configuration.ConfigurationData internal static class Zoom { + internal const string ApiKey = "zoomApiKey"; + internal const string ApiSecret = "zoomApiSecret"; internal const string Enabled = "zoomEnable"; + internal const string MeetingNumber = "zoomRoom"; + internal const string Signature = "zoomToken"; + internal const string UserName = "zoomUserInfoDisplayName"; } } diff --git a/SafeExamBrowser.Proctoring.Contracts/IProctoringController.cs b/SafeExamBrowser.Proctoring.Contracts/IProctoringController.cs index d2443764..e4bfc6bc 100644 --- a/SafeExamBrowser.Proctoring.Contracts/IProctoringController.cs +++ b/SafeExamBrowser.Proctoring.Contracts/IProctoringController.cs @@ -16,12 +16,12 @@ namespace SafeExamBrowser.Proctoring.Contracts public interface IProctoringController { /// - /// + /// Initializes the given settings and starts the proctoring if the settings are valid. /// void Initialize(ProctoringSettings settings); /// - /// + /// Stops the proctoring functionality. /// void Terminate(); } diff --git a/SafeExamBrowser.Proctoring/ProctoringController.cs b/SafeExamBrowser.Proctoring/ProctoringController.cs index e2533dba..2a5f24f0 100644 --- a/SafeExamBrowser.Proctoring/ProctoringController.cs +++ b/SafeExamBrowser.Proctoring/ProctoringController.cs @@ -19,6 +19,7 @@ using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Proctoring.Contracts; using SafeExamBrowser.Server.Contracts; +using SafeExamBrowser.Server.Contracts.Events; using SafeExamBrowser.Settings.Proctoring; using SafeExamBrowser.SystemComponents.Contracts; using SafeExamBrowser.UserInterface.Contracts; @@ -97,7 +98,7 @@ namespace SafeExamBrowser.Proctoring else if (settings.Zoom.Enabled) { start = !string.IsNullOrWhiteSpace(settings.Zoom.ApiKey); - start &= !string.IsNullOrWhiteSpace(settings.Zoom.ApiSecret); + start &= !string.IsNullOrWhiteSpace(settings.Zoom.ApiSecret) || !string.IsNullOrWhiteSpace(settings.Zoom.Signature); start &= !string.IsNullOrWhiteSpace(settings.Zoom.MeetingNumber); start &= !string.IsNullOrWhiteSpace(settings.Zoom.UserName); } @@ -113,13 +114,19 @@ namespace SafeExamBrowser.Proctoring StopProctoring(); } - private void Server_ProctoringInstructionReceived(string roomName, string serverUrl, string token) + private void Server_ProctoringInstructionReceived(ProctoringInstructionEventArgs args) { logger.Info("Proctoring instruction received."); - settings.JitsiMeet.RoomName = roomName; - settings.JitsiMeet.ServerUrl = Sanitize(serverUrl); - settings.JitsiMeet.Token = token; + settings.JitsiMeet.RoomName = args.JitsiMeetRoomName; + settings.JitsiMeet.ServerUrl = args.JitsiMeetServerUrl; + settings.JitsiMeet.Token = args.JitsiMeetToken; + + settings.Zoom.ApiKey = args.ZoomApiKey; + settings.Zoom.MeetingNumber = args.ZoomMeetingNumber; + settings.Zoom.Password = args.ZoomPassword; + settings.Zoom.Signature = args.ZoomSignature; + settings.Zoom.UserName = args.ZoomUserName; StopProctoring(); StartProctoring(); @@ -142,6 +149,7 @@ namespace SafeExamBrowser.Proctoring settings.WindowVisibility = windowVisibility; } + // TODO: This is apparently not necessary for Zoom, there we can enable / disable the options via API call! StopProctoring(); StartProctoring(); } @@ -237,6 +245,8 @@ namespace SafeExamBrowser.Proctoring html = html.Replace("%%_API_KEY_%%", settings.Zoom.ApiKey); html = html.Replace("%%_API_SECRET_%%", settings.Zoom.ApiSecret); html = html.Replace("%%_MEETING_NUMBER_%%", settings.Zoom.MeetingNumber); + html = html.Replace("%%_PASSWORD_%%", settings.Zoom.Password); + html = html.Replace("%%_SIGNATURE_%%", settings.Zoom.Signature); html = html.Replace("%%_USER_NAME_%%", settings.Zoom.UserName); } diff --git a/SafeExamBrowser.Proctoring/Zoom/index.html b/SafeExamBrowser.Proctoring/Zoom/index.html index a45c140e..7e49eaee 100644 --- a/SafeExamBrowser.Proctoring/Zoom/index.html +++ b/SafeExamBrowser.Proctoring/Zoom/index.html @@ -14,32 +14,41 @@