- enforce lock settings when user joins voice conf

- make sure liten only user is muted when they join voice conf
This commit is contained in:
Richard Alam 2019-12-06 11:11:48 -08:00
parent ace413b319
commit bcc14792ea
3 changed files with 53 additions and 20 deletions

View File

@ -7,9 +7,7 @@ import org.bigbluebutton.core2.{ MeetingStatus2x }
object LockSettingsUtil {
def applyMutingOfUsers(mute: Boolean, liveMeeting: LiveMeeting, outGW: OutMsgRouter): Unit = {
def muteUserInVoiceConf(vu: VoiceUserState, mute: Boolean): Unit = {
def muteUserInVoiceConf(liveMeeting: LiveMeeting, outGW: OutMsgRouter, vu: VoiceUserState, mute: Boolean): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, vu.intId)
val envelope = BbbCoreEnvelope(MuteUserInVoiceConfSysMsg.NAME, routing)
val header = BbbCoreHeaderWithMeetingId(MuteUserInVoiceConfSysMsg.NAME, liveMeeting.props.meetingProp.intId)
@ -21,17 +19,18 @@ object LockSettingsUtil {
outGW.send(msgEvent)
}
def applyMutingOfUsers(mute: Boolean, liveMeeting: LiveMeeting, outGW: OutMsgRouter): Unit = {
VoiceUsers.findAll(liveMeeting.voiceUsers) foreach { vu =>
Users2x.findWithIntId(liveMeeting.users2x, vu.intId).foreach { user =>
if (user.role == Roles.VIEWER_ROLE) {
if (mute) {
// Mute everyone. We also mute listenOnly users as sledgehammer to make sure
// audio can't be transmitted. (ralam dec 6, 2019)
muteUserInVoiceConf(vu, mute)
muteUserInVoiceConf(liveMeeting, outGW, vu, mute)
} else {
// Only unmute viewers and non-listenOnly users.
if (!vu.listenOnly) {
muteUserInVoiceConf(vu, mute)
muteUserInVoiceConf(liveMeeting, outGW, vu, mute)
}
}
}
@ -39,9 +38,36 @@ object LockSettingsUtil {
}
}
def enforceLockSettingsForVoice(liveMeeting: LiveMeeting, outGW: OutMsgRouter): Unit = {
def enforceLockSettingsForAllVoiceUsers(liveMeeting: LiveMeeting, outGW: OutMsgRouter): Unit = {
val permissions = MeetingStatus2x.getPermissions(liveMeeting.status)
applyMutingOfUsers(permissions.disableMic, liveMeeting, outGW)
}
def enforceLockSettingsForVoiceUser(intUserId: String, liveMeeting: LiveMeeting, outGW: OutMsgRouter): Unit = {
val permissions = MeetingStatus2x.getPermissions(liveMeeting.status)
if (permissions.disableMic) {
Users2x.findWithIntId(liveMeeting.users2x, intUserId).foreach { user =>
if (user.role == Roles.VIEWER_ROLE) {
val voiceUser = VoiceUsers.findWithIntId(liveMeeting.voiceUsers, intUserId)
voiceUser.foreach { vu =>
// Make sure that user is muted when lock settings has mic disabled. (ralam dec 6, 2019
if (!vu.muted) {
muteUserInVoiceConf(liveMeeting, outGW, vu, true)
}
}
}
}
}
}
def enforceListenOnlyUserIsMuted(intUserId: String, liveMeeting: LiveMeeting, outGW: OutMsgRouter): Unit = {
val voiceUser = VoiceUsers.findWithIntId(liveMeeting.voiceUsers, intUserId)
voiceUser.foreach { vu =>
// Make sure that listen only user is muted. (ralam dec 6, 2019
if (vu.listenOnly && !vu.muted) {
muteUserInVoiceConf(liveMeeting, outGW, vu, true)
}
}
}
}

View File

@ -37,7 +37,7 @@ trait ChangeLockSettingsInMeetingCmdMsgHdlr extends RightsManagementTrait {
MeetingStatus2x.setPermissions(liveMeeting.status, settings)
LockSettingsUtil.enforceLockSettingsForVoice(liveMeeting, outGW)
LockSettingsUtil.enforceLockSettingsForAllVoiceUsers(liveMeeting, outGW)
val routing = Routing.addMsgToClientRouting(
MessageTypes.BROADCAST_TO_MEETING,

View File

@ -1,5 +1,6 @@
package org.bigbluebutton.core.apps.voice
import org.bigbluebutton.LockSettingsUtil
import org.bigbluebutton.common2.msgs.{BbbClientMsgHeader, BbbCommonEnvCoreMsg, BbbCoreEnvelope, ConfVoiceUser, MessageTypes, Routing, UserJoinedVoiceConfToClientEvtMsg, UserJoinedVoiceConfToClientEvtMsgBody, UserLeftVoiceConfToClientEvtMsg, UserLeftVoiceConfToClientEvtMsgBody, UserMutedVoiceEvtMsg, UserMutedVoiceEvtMsgBody}
import org.bigbluebutton.core.apps.breakout.BreakoutHdlrHelpers
import org.bigbluebutton.core.bus.InternalEventBus
@ -250,6 +251,12 @@ object VoiceApp {
)
outGW.send(event)
}
LockSettingsUtil.enforceListenOnlyUserIsMuted(intId,
liveMeeting,
outGW)
LockSettingsUtil.enforceLockSettingsForVoiceUser(intId, liveMeeting, outGW)
}
def handleUserLeftVoiceConfEvtMsg(