sync meeting lock settings status and handle GetLockSettingsRespMsg message. close #6669

This commit is contained in:
Joao Siebel 2019-02-04 13:56:07 -02:00
parent 66a6189bb5
commit 555ee1232a
5 changed files with 43 additions and 29 deletions

View File

@ -1,41 +1,39 @@
package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.running.{ MeetingActor, OutMsgRouter }
import org.bigbluebutton.core.running.{ MeetingActor, OutMsgRouter, LiveMeeting }
import org.bigbluebutton.core2.MeetingStatus2x
import org.bigbluebutton.core2.Permissions
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.domain.MeetingState2x
trait GetLockSettingsReqMsgHdlr {
this: MeetingActor =>
val outGW: OutMsgRouter
def buildLockSettingsResp(meetingId: String, requestedBy: String, settings: Permissions): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, requestedBy)
val envelope = BbbCoreEnvelope(GetLockSettingsRespMsg.NAME, routing)
val body = GetLockSettingsRespMsgBody(
disableCam = settings.disableCam,
disableMic = settings.disableMic, disablePrivChat = settings.disablePrivChat,
disablePubChat = settings.disablePubChat, lockedLayout = settings.lockedLayout,
lockOnJoin = settings.lockOnJoin, lockOnJoinConfigurable = settings.lockOnJoinConfigurable)
val header = BbbClientMsgHeader(GetLockSettingsRespMsg.NAME, meetingId, requestedBy)
val event = GetLockSettingsRespMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
def buildNotInitializedResp(meetingId: String, requestedBy: String): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, requestedBy)
val envelope = BbbCoreEnvelope(LockSettingsNotInitializedRespMsg.NAME, routing)
val body = LockSettingsNotInitializedRespMsgBody(requestedBy)
val header = BbbClientMsgHeader(LockSettingsNotInitializedRespMsg.NAME, meetingId, requestedBy)
val event = LockSettingsNotInitializedRespMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
def handleGetLockSettingsReqMsg(msg: GetLockSettingsReqMsg): Unit = {
def buildLockSettingsResp(meetingId: String, requestedBy: String, settings: Permissions): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, requestedBy)
val envelope = BbbCoreEnvelope(GetLockSettingsRespMsg.NAME, routing)
val body = GetLockSettingsRespMsgBody(
disableCam = settings.disableCam,
disableMic = settings.disableMic, disablePrivChat = settings.disablePrivChat,
disablePubChat = settings.disablePubChat, lockedLayout = settings.lockedLayout,
lockOnJoin = settings.lockOnJoin, lockOnJoinConfigurable = settings.lockOnJoinConfigurable)
val header = BbbClientMsgHeader(GetLockSettingsRespMsg.NAME, meetingId, requestedBy)
val event = GetLockSettingsRespMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
def buildNotInitializedResp(meetingId: String, requestedBy: String): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, requestedBy)
val envelope = BbbCoreEnvelope(LockSettingsNotInitializedRespMsg.NAME, routing)
val body = LockSettingsNotInitializedRespMsgBody(requestedBy)
val header = BbbClientMsgHeader(LockSettingsNotInitializedRespMsg.NAME, meetingId, requestedBy)
val event = LockSettingsNotInitializedRespMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
if (MeetingStatus2x.permisionsInitialized(liveMeeting.status)) {
val settings = MeetingStatus2x.getPermissions(liveMeeting.status)
val event = buildLockSettingsResp(props.meetingProp.intId, msg.body.requesterId, settings)
@ -45,4 +43,17 @@ trait GetLockSettingsReqMsgHdlr {
outGW.send(event)
}
}
def handleSyncGetLockSettingsMsg(state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = {
if (MeetingStatus2x.permisionsInitialized(liveMeeting.status)) {
val settings = MeetingStatus2x.getPermissions(liveMeeting.status)
val event = buildLockSettingsResp(props.meetingProp.intId, "nodeJSapp", settings)
bus.outGW.send(event)
} else {
val event = buildNotInitializedResp(props.meetingProp.intId, "nodeJSapp")
bus.outGW.send(event)
}
state
}
}

View File

@ -453,7 +453,9 @@ class MeetingActor(
// sync all voice users
handleSyncGetVoiceUsersMsg(state, liveMeeting, msgBus)
// TODO send all lock settings
// sync all lock settings
handleSyncGetLockSettingsMsg(state, liveMeeting, msgBus)
// TODO send all screen sharing info
}

View File

@ -18,3 +18,4 @@ RedisPubSub.on('UserLockedInMeetingEvtMsg', handleUserLockChange);
RedisPubSub.on('RecordingStatusChangedEvtMsg', handleRecordingStatusChange);
RedisPubSub.on('UpdateRecordingTimerEvtMsg', handleRecordingTimerChange);
RedisPubSub.on('WebcamsOnlyForModeratorChangedEvtMsg', handleChangeWebcamOnlyModerator);
RedisPubSub.on('GetLockSettingsRespMsg', handleMeetingLocksChange);

View File

@ -19,7 +19,7 @@ export default function toggleLockSettings(credentials, meeting) {
lockedLayout: Boolean,
lockOnJoin: Boolean,
lockOnJoinConfigurable: Boolean,
setBy: String,
setBy: Match.Maybe(String),
});
const payload = {

View File

@ -12,7 +12,7 @@ export default function changeLockSettings(meetingId, payload) {
lockedLayout: Boolean,
lockOnJoin: Boolean,
lockOnJoinConfigurable: Boolean,
setBy: String,
setBy: Match.Maybe(String),
});
const selector = {