Merge pull request #14541 from gustavotrott/fix-breakout-user-remove

fix: Users not being ejected from breakout rooms (only from main room)
This commit is contained in:
Anton Georgiev 2022-03-09 09:57:17 -05:00 committed by GitHub
commit d737ad59b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 3 deletions

View File

@ -83,6 +83,18 @@ case class EndBreakoutRoomInternalMsg(parentId: String, breakoutId: String, reas
*/
case class ExtendBreakoutRoomTimeInternalMsg(parentId: String, breakoutId: String, extendTimeInMinutes: Int) extends InMessage
/**
* Sent by parent meeting to breakout room to eject user.
* @param parentId
* @param breakoutId
* @param extUserId
* @param ejectedBy
* @param reason
* @param reasonCode
* @param ban
*/
case class EjectUserFromBreakoutInternalMsg(parentId: String, breakoutId: String, extUserId: String, ejectedBy: String, reason: String, reasonCode: String, ban: Boolean) extends InMessage
// DeskShare
case class DeskShareStartedRequest(conferenceName: String, callerId: String, callerIdName: String) extends InMessage
case class DeskShareStoppedRequest(conferenceName: String, callerId: String, callerIdName: String) extends InMessage

View File

@ -16,6 +16,7 @@ trait BreakoutApp2x extends BreakoutRoomCreatedMsgHdlr
with TransferUserToMeetingRequestHdlr
with EndBreakoutRoomInternalMsgHdlr
with ExtendBreakoutRoomTimeInternalMsgHdlr
with EjectUserFromBreakoutInternalMsgHdlr
with BreakoutRoomEndedInternalMsgHdlr {
this: MeetingActor =>

View File

@ -0,0 +1,37 @@
package org.bigbluebutton.core.apps.breakout
import org.bigbluebutton.core.api.EjectUserFromBreakoutInternalMsg
import org.bigbluebutton.core.apps.users.UsersApp
import org.bigbluebutton.core.models.{ RegisteredUsers }
import org.bigbluebutton.core.running.{ LiveMeeting, MeetingActor, OutMsgRouter }
import org.bigbluebutton.core2.message.senders.Sender
trait EjectUserFromBreakoutInternalMsgHdlr {
this: MeetingActor =>
val liveMeeting: LiveMeeting
val outGW: OutMsgRouter
def handleEjectUserFromBreakoutInternalMsgHdlr(msg: EjectUserFromBreakoutInternalMsg) = {
for {
registeredUser <- RegisteredUsers.findAllWithExternUserId(msg.extUserId, liveMeeting.registeredUsers)
} yield {
UsersApp.ejectUserFromMeeting(
outGW,
liveMeeting,
registeredUser.id,
msg.ejectedBy,
msg.reason,
msg.reasonCode,
msg.ban
)
// send a system message to force disconnection
Sender.sendDisconnectClientSysMsg(msg.breakoutId, registeredUser.id, msg.ejectedBy, msg.reasonCode, outGW)
log.info("Eject user {} id={} in breakoutId {}", registeredUser.name, registeredUser.id, msg.breakoutId)
}
}
}

View File

@ -1,9 +1,12 @@
package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.api.{ EjectUserFromBreakoutInternalMsg }
import org.bigbluebutton.core.running.{ LiveMeeting, OutMsgRouter }
import org.bigbluebutton.core2.message.senders.Sender
import org.bigbluebutton.core.apps.{ PermissionCheck, RightsManagementTrait }
import org.bigbluebutton.core.bus.BigBlueButtonEvent
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.models.{ EjectReasonCode, RegisteredUsers }
trait EjectUserFromMeetingCmdMsgHdlr extends RightsManagementTrait {
@ -12,7 +15,7 @@ trait EjectUserFromMeetingCmdMsgHdlr extends RightsManagementTrait {
val liveMeeting: LiveMeeting
val outGW: OutMsgRouter
def handleEjectUserFromMeetingCmdMsg(msg: EjectUserFromMeetingCmdMsg) {
def handleEjectUserFromMeetingCmdMsg(msg: EjectUserFromMeetingCmdMsg, state: MeetingState2x) {
val meetingId = liveMeeting.props.meetingProp.intId
val userId = msg.body.userId
val ejectedBy = msg.body.ejectedBy
@ -42,6 +45,18 @@ trait EjectUserFromMeetingCmdMsgHdlr extends RightsManagementTrait {
// Hunt down all registered users based on extern userid and eject them all.
// ralam april 21, 2020
RegisteredUsers.findAllWithExternUserId(registeredUser.externId, liveMeeting.registeredUsers) foreach { ru =>
//Eject from Breakouts
for {
breakoutModel <- state.breakout
} yield {
breakoutModel.rooms.values.foreach { room =>
room.users.filter(u => u.id == ru.externId + "-" + room.sequence).foreach(user => {
eventBus.publish(BigBlueButtonEvent(room.id, EjectUserFromBreakoutInternalMsg(meetingId, room.id, user.id, ejectedBy, reason, EjectReasonCode.EJECT_USER, ban)))
})
}
}
//println("****************** User " + ejectedBy + " ejecting other user " + ru.id)
UsersApp.ejectUserFromMeeting(
outGW,
@ -53,7 +68,7 @@ trait EjectUserFromMeetingCmdMsgHdlr extends RightsManagementTrait {
ban
)
log.info("Eject userId=" + userId + " by " + ejectedBy + " and ban=" + banUser)
log.info("Eject user {} userId={} by {} and ban=" + banUser + " in meeting {}", registeredUser.name, userId, ejectedBy, meetingId)
// send a system message to force disconnection
Sender.sendDisconnectClientSysMsg(meetingId, ru.id, ejectedBy, EjectReasonCode.EJECT_USER, outGW)

View File

@ -284,6 +284,7 @@ class MeetingActor(
case msg: BreakoutRoomUsersUpdateInternalMsg => state = handleBreakoutRoomUsersUpdateInternalMsg(msg, state)
case msg: EndBreakoutRoomInternalMsg => handleEndBreakoutRoomInternalMsg(msg)
case msg: ExtendBreakoutRoomTimeInternalMsg => state = handleExtendBreakoutRoomTimeInternalMsgHdlr(msg, state)
case msg: EjectUserFromBreakoutInternalMsg => handleEjectUserFromBreakoutInternalMsgHdlr(msg)
case msg: BreakoutRoomEndedInternalMsg => state = handleBreakoutRoomEndedInternalMsg(msg, state)
case msg: SendBreakoutTimeRemainingInternalMsg =>
handleSendBreakoutTimeRemainingInternalMsg(msg)
@ -408,7 +409,7 @@ class MeetingActor(
// Client requested to eject user
case m: EjectUserFromMeetingCmdMsg =>
usersApp.handleEjectUserFromMeetingCmdMsg(m)
usersApp.handleEjectUserFromMeetingCmdMsg(m, state)
updateUserLastActivity(m.body.ejectedBy)
// Another part of system (e.g. bbb-apps) requested to eject user.