Merge pull request #15234 from prlanzarin/u26/fix/ghi15233
fix: remove userLeftFlag from audio, camera and screen sharing auth checks
This commit is contained in:
commit
6c0af3631d
@ -75,6 +75,12 @@ object LockSettingsUtil {
|
||||
}
|
||||
}
|
||||
|
||||
def isMicrophoneSharingLocked(user: UserState, liveMeeting: LiveMeeting): Boolean = {
|
||||
val permissions = MeetingStatus2x.getPermissions(liveMeeting.status)
|
||||
|
||||
user.role == Roles.VIEWER_ROLE && user.locked && permissions.disableMic
|
||||
}
|
||||
|
||||
def isCameraBroadcastLocked(user: UserState, liveMeeting: LiveMeeting): Boolean = {
|
||||
val permissions = MeetingStatus2x.getPermissions(liveMeeting.status)
|
||||
|
||||
|
@ -25,8 +25,7 @@ trait GetScreenBroadcastPermissionReqMsgHdlr {
|
||||
val meetingId = liveMeeting.props.meetingProp.intId
|
||||
val reason = "No permission to share the screen."
|
||||
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, outGW, liveMeeting)
|
||||
} else if (!user.userLeftFlag.left
|
||||
&& liveMeeting.props.meetingProp.intId == msg.body.meetingId
|
||||
} else if (liveMeeting.props.meetingProp.intId == msg.body.meetingId
|
||||
&& liveMeeting.props.voiceProp.voiceConf == msg.body.voiceConf) {
|
||||
allowed = true
|
||||
}
|
||||
|
@ -17,8 +17,7 @@ trait GetScreenSubscribePermissionReqMsgHdlr {
|
||||
for {
|
||||
user <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId)
|
||||
} yield {
|
||||
if (!user.userLeftFlag.left
|
||||
&& liveMeeting.props.meetingProp.intId == msg.body.meetingId
|
||||
if (liveMeeting.props.meetingProp.intId == msg.body.meetingId
|
||||
&& liveMeeting.props.voiceProp.voiceConf == msg.body.voiceConf
|
||||
&& ScreenshareModel.getRTMPBroadcastingUrl(liveMeeting.screenshareModel) == msg.body.streamId) {
|
||||
allowed = true
|
||||
|
@ -1,35 +1,51 @@
|
||||
package org.bigbluebutton.core2.message.handlers
|
||||
package org.bigbluebutton.core.apps.voice
|
||||
|
||||
import org.bigbluebutton.common2.msgs._
|
||||
import org.bigbluebutton.core.running.{ MeetingActor, OutMsgRouter }
|
||||
import org.bigbluebutton.core.models.Users2x
|
||||
import org.bigbluebutton.core2.message.senders.MsgBuilder
|
||||
import org.bigbluebutton.core.running.{ LiveMeeting, MeetingActor, OutMsgRouter }
|
||||
|
||||
trait GetGlobalAudioPermissionReqMsgHdlr {
|
||||
this: MeetingActor =>
|
||||
|
||||
val outGW: OutMsgRouter
|
||||
|
||||
def handleGetGlobalAudioPermissionReqMsg(msg: GetGlobalAudioPermissionReqMsg) {
|
||||
var allowed = false
|
||||
def handleGetGlobalAudioPermissionReqMsg(msg: GetGlobalAudioPermissionReqMsg): Unit = {
|
||||
|
||||
for {
|
||||
user <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId)
|
||||
} yield {
|
||||
if (!user.userLeftFlag.left
|
||||
&& liveMeeting.props.meetingProp.intId == msg.body.meetingId
|
||||
&& liveMeeting.props.voiceProp.voiceConf == msg.body.voiceConf) {
|
||||
allowed = true
|
||||
}
|
||||
def broadcastEvent(
|
||||
meetingId: String,
|
||||
voiceConf: String,
|
||||
userId: String,
|
||||
sfuSessionId: String,
|
||||
allowed: Boolean
|
||||
): Unit = {
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, userId)
|
||||
val envelope = BbbCoreEnvelope(GetGlobalAudioPermissionRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(GetGlobalAudioPermissionRespMsg.NAME, meetingId, userId)
|
||||
val body = GetGlobalAudioPermissionRespMsgBody(
|
||||
meetingId,
|
||||
voiceConf,
|
||||
userId,
|
||||
sfuSessionId,
|
||||
allowed
|
||||
)
|
||||
val event = GetGlobalAudioPermissionRespMsg(header, body)
|
||||
val eventMsg = BbbCommonEnvCoreMsg(envelope, event)
|
||||
|
||||
outGW.send(eventMsg)
|
||||
}
|
||||
|
||||
val event = MsgBuilder.buildGetGlobalAudioPermissionRespMsg(
|
||||
val allowed = VoiceHdlrHelpers.isGlobalAudioSubscribeAllowed(
|
||||
liveMeeting,
|
||||
msg.body.meetingId,
|
||||
msg.body.userId,
|
||||
msg.body.voiceConf
|
||||
)
|
||||
|
||||
broadcastEvent(
|
||||
liveMeeting.props.meetingProp.intId,
|
||||
liveMeeting.props.voiceProp.voiceConf,
|
||||
msg.body.userId,
|
||||
msg.body.sfuSessionId,
|
||||
allowed
|
||||
)
|
||||
outGW.send(event)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package org.bigbluebutton.core.apps.voice
|
||||
|
||||
import org.bigbluebutton.common2.msgs._
|
||||
import org.bigbluebutton.core.running.{ LiveMeeting, MeetingActor, OutMsgRouter }
|
||||
|
||||
trait GetMicrophonePermissionReqMsgHdlr {
|
||||
this: MeetingActor =>
|
||||
|
||||
val liveMeeting: LiveMeeting
|
||||
val outGW: OutMsgRouter
|
||||
|
||||
def handleGetMicrophonePermissionReqMsg(msg: GetMicrophonePermissionReqMsg): Unit = {
|
||||
|
||||
def broadcastEvent(
|
||||
meetingId: String,
|
||||
voiceConf: String,
|
||||
userId: String,
|
||||
sfuSessionId: String,
|
||||
allowed: Boolean
|
||||
): Unit = {
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, userId)
|
||||
val envelope = BbbCoreEnvelope(GetMicrophonePermissionRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(GetMicrophonePermissionRespMsg.NAME, meetingId, userId)
|
||||
val body = GetMicrophonePermissionRespMsgBody(
|
||||
meetingId,
|
||||
voiceConf,
|
||||
userId,
|
||||
sfuSessionId,
|
||||
allowed
|
||||
)
|
||||
val event = GetMicrophonePermissionRespMsg(header, body)
|
||||
val eventMsg = BbbCommonEnvCoreMsg(envelope, event)
|
||||
|
||||
outGW.send(eventMsg)
|
||||
}
|
||||
|
||||
val allowed = VoiceHdlrHelpers.isMicrophoneSharingAllowed(
|
||||
liveMeeting,
|
||||
msg.body.meetingId,
|
||||
msg.body.userId,
|
||||
msg.body.voiceConf
|
||||
)
|
||||
|
||||
broadcastEvent(
|
||||
liveMeeting.props.meetingProp.intId,
|
||||
liveMeeting.props.voiceProp.voiceConf,
|
||||
msg.body.userId,
|
||||
msg.body.sfuSessionId,
|
||||
allowed
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package org.bigbluebutton.core.apps.voice
|
||||
|
||||
import org.bigbluebutton.common2.msgs._
|
||||
import org.bigbluebutton.core.models.{ Users2x }
|
||||
import org.bigbluebutton.core.running.{ LiveMeeting }
|
||||
import org.bigbluebutton.LockSettingsUtil
|
||||
import org.bigbluebutton.SystemConfiguration
|
||||
|
||||
object VoiceHdlrHelpers extends SystemConfiguration {
|
||||
def isGlobalAudioSubscribeAllowed(
|
||||
liveMeeting: LiveMeeting,
|
||||
meetingId: String,
|
||||
userId: String,
|
||||
voiceConf: String
|
||||
): Boolean = {
|
||||
Users2x.findWithIntId(liveMeeting.users2x, userId) match {
|
||||
case Some(user) => (
|
||||
applyPermissionCheck &&
|
||||
liveMeeting.props.meetingProp.intId == meetingId &&
|
||||
liveMeeting.props.voiceProp.voiceConf == voiceConf
|
||||
)
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
|
||||
def isMicrophoneSharingAllowed(
|
||||
liveMeeting: LiveMeeting,
|
||||
meetingId: String,
|
||||
userId: String,
|
||||
voiceConf: String
|
||||
): Boolean = {
|
||||
Users2x.findWithIntId(liveMeeting.users2x, userId) match {
|
||||
case Some(user) => {
|
||||
val microphoneSharingLocked = LockSettingsUtil.isMicrophoneSharingLocked(
|
||||
user,
|
||||
liveMeeting
|
||||
)
|
||||
|
||||
(applyPermissionCheck &&
|
||||
!microphoneSharingLocked &&
|
||||
liveMeeting.props.meetingProp.intId == meetingId &&
|
||||
liveMeeting.props.voiceProp.voiceConf == voiceConf)
|
||||
}
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
}
|
@ -23,7 +23,6 @@ object CameraHdlrHelpers extends SystemConfiguration with RightsManagementTrait
|
||||
(applyPermissionCheck &&
|
||||
!camBroadcastLocked &&
|
||||
!camCapReached &&
|
||||
!user.userLeftFlag.left &&
|
||||
streamId.startsWith(user.intId) &&
|
||||
liveMeeting.props.meetingProp.intId == meetingId)
|
||||
}
|
||||
@ -43,7 +42,6 @@ object CameraHdlrHelpers extends SystemConfiguration with RightsManagementTrait
|
||||
|
||||
(applyPermissionCheck &&
|
||||
!camSubscribeLocked &&
|
||||
!user.userLeftFlag.left &&
|
||||
liveMeeting.props.meetingProp.intId == meetingId)
|
||||
}
|
||||
case _ => false
|
||||
|
@ -215,6 +215,8 @@ class ReceivedJsonMsgHandlerActor(
|
||||
routeVoiceMsg[VoiceConfCallStateEvtMsg](envelope, jsonNode)
|
||||
case GetGlobalAudioPermissionReqMsg.NAME =>
|
||||
routeGenericMsg[GetGlobalAudioPermissionReqMsg](envelope, jsonNode)
|
||||
case GetMicrophonePermissionReqMsg.NAME =>
|
||||
routeGenericMsg[GetMicrophonePermissionReqMsg](envelope, jsonNode)
|
||||
|
||||
// Breakout rooms
|
||||
case BreakoutRoomsListMsg.NAME =>
|
||||
|
@ -80,6 +80,7 @@ class MeetingActor(
|
||||
with MuteMeetingCmdMsgHdlr
|
||||
with IsMeetingMutedReqMsgHdlr
|
||||
with GetGlobalAudioPermissionReqMsgHdlr
|
||||
with GetMicrophonePermissionReqMsgHdlr
|
||||
with GetScreenBroadcastPermissionReqMsgHdlr
|
||||
with GetScreenSubscribePermissionReqMsgHdlr
|
||||
|
||||
@ -467,6 +468,8 @@ class MeetingActor(
|
||||
handleUserStatusVoiceConfEvtMsg(m)
|
||||
case m: GetGlobalAudioPermissionReqMsg =>
|
||||
handleGetGlobalAudioPermissionReqMsg(m)
|
||||
case m: GetMicrophonePermissionReqMsg =>
|
||||
handleGetMicrophonePermissionReqMsg(m)
|
||||
|
||||
// Layout
|
||||
case m: GetCurrentLayoutReqMsg => handleGetCurrentLayoutReqMsg(m)
|
||||
|
@ -461,23 +461,6 @@ object MsgBuilder {
|
||||
BbbCommonEnvCoreMsg(envelope, event)
|
||||
}
|
||||
|
||||
def buildGetGlobalAudioPermissionRespMsg(
|
||||
meetingId: String,
|
||||
voiceConf: String,
|
||||
userId: String,
|
||||
sfuSessionId: String,
|
||||
allowed: Boolean
|
||||
): BbbCommonEnvCoreMsg = {
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, userId)
|
||||
val envelope = BbbCoreEnvelope(GetGlobalAudioPermissionRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(GetGlobalAudioPermissionRespMsg.NAME, meetingId, userId)
|
||||
|
||||
val body = GetGlobalAudioPermissionRespMsgBody(meetingId, voiceConf, userId, sfuSessionId, allowed)
|
||||
val event = GetGlobalAudioPermissionRespMsg(header, body)
|
||||
|
||||
BbbCommonEnvCoreMsg(envelope, event)
|
||||
}
|
||||
|
||||
def buildMeetingTimeRemainingUpdateEvtMsg(meetingId: String, timeLeftInSec: Long, timeUpdatedInMinutes: Int = 0): BbbCommonEnvCoreMsg = {
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, "not-used")
|
||||
val envelope = BbbCoreEnvelope(MeetingTimeRemainingUpdateEvtMsg.NAME, routing)
|
||||
|
@ -561,3 +561,31 @@ case class GetGlobalAudioPermissionRespMsgBody(
|
||||
sfuSessionId: String,
|
||||
allowed: Boolean
|
||||
)
|
||||
|
||||
/* Sent by bbb-webrtc-sfu to ask permission for a new microphone/full audio
|
||||
* connection
|
||||
*/
|
||||
object GetMicrophonePermissionReqMsg { val NAME = "GetMicrophonePermissionReqMsg" }
|
||||
case class GetMicrophonePermissionReqMsg(
|
||||
header: BbbClientMsgHeader,
|
||||
body: GetMicrophonePermissionReqMsgBody
|
||||
) extends StandardMsg
|
||||
case class GetMicrophonePermissionReqMsgBody(
|
||||
meetingId: String,
|
||||
voiceConf: String,
|
||||
userId: String,
|
||||
sfuSessionId: String
|
||||
)
|
||||
|
||||
object GetMicrophonePermissionRespMsg { val NAME = "GetMicrophonePermissionRespMsg" }
|
||||
case class GetMicrophonePermissionRespMsg(
|
||||
header: BbbClientMsgHeader,
|
||||
body: GetMicrophonePermissionRespMsgBody
|
||||
) extends StandardMsg
|
||||
case class GetMicrophonePermissionRespMsgBody(
|
||||
meetingId: String,
|
||||
voiceConf: String,
|
||||
userId: String,
|
||||
sfuSessionId: String,
|
||||
allowed: Boolean
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user