From edb2ff39cc7b40552ec68d7b42e6b613476e768b Mon Sep 17 00:00:00 2001 From: Daniel Petri Rocha Date: Mon, 19 Sep 2022 19:22:29 +0200 Subject: [PATCH] Perform upload upon breakout room timeout --- .../scala/org/bigbluebutton/core/api/InMessages.scala | 2 +- .../apps/breakout/EndAllBreakoutRoomsMsgHdlr.scala | 9 ++------- .../apps/breakout/EndBreakoutRoomInternalMsgHdlr.scala | 10 ++++++++-- .../PresentationWithAnnotationsMsgHdlr.scala | 3 +-- .../bigbluebutton/core/running/HandlerHelpers.scala | 2 +- .../org/bigbluebutton/core/AppsTestFixtures.scala | 2 +- .../src/main/java/org/bigbluebutton/api/ApiParams.java | 2 +- .../java/org/bigbluebutton/api/MeetingService.java | 4 +++- .../org/bigbluebutton/api/ParamsProcessorUtil.java | 9 +++++++-- .../java/org/bigbluebutton/api/domain/Meeting.java | 4 ++++ .../api2/meeting/MeetingsManagerActor.scala | 2 +- 11 files changed, 30 insertions(+), 19 deletions(-) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala index 5fa802ecf2..2c5d54e971 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala @@ -109,7 +109,7 @@ case class EjectUserFromBreakoutInternalMsg(parentId: String, breakoutId: String * @param parentMeetingId * @param allSlides */ -case class CapturePresentationReqInternalMsg(userId: String, parentMeetingId: String, allPages: Boolean = false) extends InMessage +case class CapturePresentationReqInternalMsg(userId: String, parentMeetingId: String, allPages: Boolean = true) extends InMessage // DeskShare case class DeskShareStartedRequest(conferenceName: String, callerId: String, callerIdName: String) extends InMessage diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/EndAllBreakoutRoomsMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/EndAllBreakoutRoomsMsgHdlr.scala index 183191ab01..30af0980c9 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/EndAllBreakoutRoomsMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/EndAllBreakoutRoomsMsgHdlr.scala @@ -1,7 +1,7 @@ package org.bigbluebutton.core.apps.breakout import org.bigbluebutton.common2.msgs._ -import org.bigbluebutton.core.api.{ EndBreakoutRoomInternalMsg, CapturePresentationReqInternalMsg } +import org.bigbluebutton.core.api.EndBreakoutRoomInternalMsg import org.bigbluebutton.core.bus.BigBlueButtonEvent import org.bigbluebutton.core.domain.{ MeetingEndReason, MeetingState2x } import org.bigbluebutton.core.running.{ MeetingActor, OutMsgRouter } @@ -24,12 +24,7 @@ trait EndAllBreakoutRoomsMsgHdlr extends RightsManagementTrait { model <- state.breakout } yield { model.rooms.values.foreach { room => - eventBus.publish(BigBlueButtonEvent(room.id, EndBreakoutRoomInternalMsg(props.breakoutProps.parentId, room.id, MeetingEndReason.BREAKOUT_ENDED_BY_MOD))) - - if (room.capture) { - val event = BigBlueButtonEvent(room.id, CapturePresentationReqInternalMsg(msg.header.userId, meetingId)) - eventBus.publish(event) - } + eventBus.publish(BigBlueButtonEvent(room.id, EndBreakoutRoomInternalMsg(meetingId, room.id, MeetingEndReason.BREAKOUT_ENDED_BY_MOD))) } val notifyEvent = MsgBuilder.buildNotifyAllInMeetingEvtMsg( diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/EndBreakoutRoomInternalMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/EndBreakoutRoomInternalMsgHdlr.scala index 051d9720c4..ad9ae85196 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/EndBreakoutRoomInternalMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/EndBreakoutRoomInternalMsgHdlr.scala @@ -1,7 +1,7 @@ package org.bigbluebutton.core.apps.breakout -import org.bigbluebutton.core.api.EndBreakoutRoomInternalMsg -import org.bigbluebutton.core.bus.{ InternalEventBus } +import org.bigbluebutton.core.api.{ CapturePresentationReqInternalMsg, EndBreakoutRoomInternalMsg } +import org.bigbluebutton.core.bus.{ BigBlueButtonEvent, InternalEventBus } import org.bigbluebutton.core.running.{ BaseMeetingActor, HandlerHelpers, LiveMeeting, OutMsgRouter } trait EndBreakoutRoomInternalMsgHdlr extends HandlerHelpers { @@ -12,6 +12,12 @@ trait EndBreakoutRoomInternalMsgHdlr extends HandlerHelpers { val eventBus: InternalEventBus def handleEndBreakoutRoomInternalMsg(msg: EndBreakoutRoomInternalMsg): Unit = { + + if (liveMeeting.props.breakoutProps.capture) { + val event = BigBlueButtonEvent(msg.breakoutId, CapturePresentationReqInternalMsg("system", msg.parentId)) + eventBus.publish(event) + } + log.info("Breakout room {} ended by parent meeting {}.", msg.breakoutId, msg.parentId) sendEndMeetingDueToExpiry(msg.reason, eventBus, outGW, liveMeeting, "system") } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationWithAnnotationsMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationWithAnnotationsMsgHdlr.scala index 83e2f7a6bb..9a80b4576f 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationWithAnnotationsMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationWithAnnotationsMsgHdlr.scala @@ -130,8 +130,7 @@ trait PresentationWithAnnotationsMsgHdlr extends RightsManagementTrait { val currentPres: Option[PresentationInPod] = presentationPods.flatMap(_.getCurrentPresentation()).headOption if (liveMeeting.props.meetingProp.disabledFeatures.contains("importPresentationWithAnnotationsFromBreakoutRooms")) { - val reason = "Importing slides from breakout rooms disabled for this meeting." - PermissionCheck.ejectUserForFailedPermission(meetingId, userId, reason, bus.outGW, liveMeeting) + log.error(s"Capturing breakout rooms slides disabled in meeting ${meetingId}.") } else if (currentPres.isEmpty) { log.error(s"No presentation set in meeting ${meetingId}") } else { diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala index 9a4a3212fc..eb852acc7d 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala @@ -226,7 +226,7 @@ trait HandlerHelpers extends SystemConfiguration { model <- state.breakout } yield { model.rooms.values.foreach { room => - eventBus.publish(BigBlueButtonEvent(room.id, EndBreakoutRoomInternalMsg(liveMeeting.props.breakoutProps.parentId, room.id, reason))) + eventBus.publish(BigBlueButtonEvent(room.id, EndBreakoutRoomInternalMsg(liveMeeting.props.meetingProp.intId, room.id, reason))) } } diff --git a/akka-bbb-apps/src/test/scala/org/bigbluebutton/core/AppsTestFixtures.scala b/akka-bbb-apps/src/test/scala/org/bigbluebutton/core/AppsTestFixtures.scala index 0c62aa723c..4e9e2f85f9 100755 --- a/akka-bbb-apps/src/test/scala/org/bigbluebutton/core/AppsTestFixtures.scala +++ b/akka-bbb-apps/src/test/scala/org/bigbluebutton/core/AppsTestFixtures.scala @@ -47,7 +47,7 @@ trait AppsTestFixtures { val meetingLayout = "" val metadata: collection.immutable.Map[String, String] = Map("foo" -> "bar", "bar" -> "baz", "baz" -> "foo") - val breakoutProps = BreakoutProps(parentId = parentMeetingId, sequence = sequence, freeJoin = false capture = false, breakoutRooms = Vector()) + val breakoutProps = BreakoutProps(parentId = parentMeetingId, sequence = sequence, freeJoin = false, capture = false, breakoutRooms = Vector()) val meetingProp = MeetingProp(name = meetingName, extId = externalMeetingId, intId = meetingId, meetingCameraCap = meetingCameraCap, diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/ApiParams.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/ApiParams.java index c8a7b58f0c..354605f79e 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/ApiParams.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/ApiParams.java @@ -31,7 +31,6 @@ public class ApiParams { public static final String DIAL_NUMBER = "dialNumber"; public static final String DURATION = "duration"; public static final String FREE_JOIN = "freeJoin"; - public static final String CAPTURE = "capture"; public static final String FULL_NAME = "fullName"; public static final String GUEST_POLICY = "guestPolicy"; public static final String MEETING_LAYOUT = "meetingLayout"; @@ -74,6 +73,7 @@ public class ApiParams { public static final String DISABLED_FEATURES = "disabledFeatures"; public static final String NOTIFY_RECORDING_IS_ON = "notifyRecordingIsOn"; + public static final String BREAKOUT_ROOMS_CAPTURE = "capture"; public static final String BREAKOUT_ROOMS_ENABLED = "breakoutRoomsEnabled"; public static final String BREAKOUT_ROOMS_RECORD = "breakoutRoomsRecord"; public static final String BREAKOUT_ROOMS_PRIVATE_CHAT_ENABLED = "breakoutRoomsPrivateChatEnabled"; diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java index cd2e79ab70..c809e1c4bb 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java @@ -377,6 +377,7 @@ public class MeetingService implements MessageListener { breakoutMetadata.put("meetingId", m.getExternalId()); breakoutMetadata.put("sequence", m.getSequence().toString()); breakoutMetadata.put("freeJoin", m.isFreeJoin().toString()); + breakoutMetadata.put("capture", m.isCaptured().toString()); breakoutMetadata.put("parentMeetingId", m.getParentMeetingId()); storeService.recordBreakoutInfo(m.getInternalId(), breakoutMetadata); } @@ -388,6 +389,7 @@ public class MeetingService implements MessageListener { if (m.isBreakout()) { logData.put("sequence", m.getSequence()); logData.put("freeJoin", m.isFreeJoin()); + logData.put("capture", m.isCaptured()); logData.put("parentMeetingId", m.getParentMeetingId()); } logData.put("name", m.getName()); @@ -660,7 +662,7 @@ public class MeetingService implements MessageListener { params.put(ApiParams.IS_BREAKOUT, "true"); params.put(ApiParams.SEQUENCE, message.sequence.toString()); params.put(ApiParams.FREE_JOIN, message.freeJoin.toString()); - params.put(ApiParams.CAPTURE, message.capture.toString()); + params.put(ApiParams.BREAKOUT_ROOMS_CAPTURE, message.capture.toString()); params.put(ApiParams.ATTENDEE_PW, message.viewerPassword); params.put(ApiParams.MODERATOR_PW, message.moderatorPassword); params.put(ApiParams.DIAL_NUMBER, message.dialNumber); diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java index 82fe2b6a1e..7888808a99 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java @@ -263,7 +263,6 @@ public class ParamsProcessorUtil { private BreakoutRoomsParams processBreakoutRoomsParams(Map params) { Boolean breakoutRoomsRecord = defaultBreakoutRoomsRecord; - Boolean breakoutRoomsCapture = defaultBreakoutRoomsCapture; String breakoutRoomsRecordParam = params.get(ApiParams.BREAKOUT_ROOMS_RECORD); if (!StringUtils.isEmpty(breakoutRoomsRecordParam)) { breakoutRoomsRecord = Boolean.parseBoolean(breakoutRoomsRecordParam); @@ -275,6 +274,12 @@ public class ParamsProcessorUtil { breakoutRoomsPrivateChatEnabled = Boolean.parseBoolean(breakoutRoomsPrivateChatEnabledParam); } + Boolean breakoutRoomsCapture = defaultBreakoutRoomsCapture; + String breakoutRoomsCaptureParam = params.get(ApiParams.BREAKOUT_ROOMS_CAPTURE); + if (!StringUtils.isEmpty(breakoutRoomsCaptureParam)) { + breakoutRoomsCapture = Boolean.parseBoolean(breakoutRoomsCaptureParam); + } + return new BreakoutRoomsParams(breakoutRoomsRecord, breakoutRoomsPrivateChatEnabled, breakoutRoomsCapture); } @@ -730,7 +735,7 @@ public class ParamsProcessorUtil { if (isBreakout) { meeting.setSequence(Integer.parseInt(params.get(ApiParams.SEQUENCE))); meeting.setFreeJoin(Boolean.parseBoolean(params.get(ApiParams.FREE_JOIN))); - meeting.setCapture(Boolean.parseBoolean(params.get(ApiParams.CAPTURE))); + meeting.setCapture(Boolean.parseBoolean(params.get(ApiParams.BREAKOUT_ROOMS_CAPTURE))); meeting.setParentMeetingId(parentMeetingId); } diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/domain/Meeting.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/domain/Meeting.java index 1e8629ccb8..8cdcaf5559 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/domain/Meeting.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/domain/Meeting.java @@ -285,6 +285,10 @@ public class Meeting { this.freeJoin = freeJoin; } + public Boolean isCaptured() { + return capture; + } + public void setCapture(Boolean capture) { this.capture = capture; } diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala index 3e7732e1b0..8b72ece734 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala @@ -12,7 +12,7 @@ case class CreateBreakoutRoomMsg(meetingId: String, parentMeetingId: String, name: String, sequence: Integer, freeJoin: Boolean, dialNumber: String, voiceConfId: String, viewerPassword: String, moderatorPassword: String, duration: Int, sourcePresentationId: String, sourcePresentationSlide: Int, - record: Boolean) extends ApiMsg + record: Boolean, capture: Boolean) extends ApiMsg case class AddUserSession(token: String, session: UserSession) case class RegisterUser(meetingId: String, intUserId: String, name: String, role: String,