- convert over lock setting into 2x messages

This commit is contained in:
Richard Alam 2017-07-26 13:19:19 -07:00
parent 67808fcb66
commit 6fb08c1396
11 changed files with 202 additions and 98 deletions

View File

@ -0,0 +1,34 @@
package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.api.Permissions
import org.bigbluebutton.core.running.{ MeetingActor, OutMsgRouter }
import org.bigbluebutton.core2.MeetingStatus2x
trait GetLockSettingsReqMsgHdlr {
this: MeetingActor =>
val outGW: OutMsgRouter
def handleGetLockSettingsReqMsg(msg: GetLockSettingsReqMsg): Unit = {
def build(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)
}
val settings = MeetingStatus2x.getPermissions(liveMeeting.status)
val event = build(props.meetingProp.intId, msg.body.requesterId, settings)
outGW.send(event)
}
}

View File

@ -9,7 +9,7 @@ trait LockUserInMeetingCmdMsgHdlr {
val outGW: OutMsgRouter val outGW: OutMsgRouter
def handle(msg: LockUserInMeetingCmdMsg) { def handleLockUserInMeetingCmdMsg(msg: LockUserInMeetingCmdMsg) {
def build(meetingId: String, userId: String, lockedBy: String, locked: Boolean): BbbCommonEnvCoreMsg = { def build(meetingId: String, userId: String, lockedBy: String, locked: Boolean): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId) val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId)

View File

@ -0,0 +1,36 @@
package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.models.Users2x
import org.bigbluebutton.core.running.{ MeetingActor, OutMsgRouter }
trait LockUsersInMeetingCmdMsgHdlr {
this: MeetingActor =>
val outGW: OutMsgRouter
def handleLockUsersInMeetingCmdMsg(msg: LockUsersInMeetingCmdMsg) {
def build(meetingId: String, userId: String, lockedBy: String, locked: Boolean): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId)
val envelope = BbbCoreEnvelope(UserLockedInMeetingEvtMsg.NAME, routing)
val body = UserLockedInMeetingEvtMsgBody(userId, locked, lockedBy)
val header = BbbClientMsgHeader(UserLockedInMeetingEvtMsg.NAME, meetingId, userId)
val event = UserLockedInMeetingEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val usersToLock = Users2x.findAll(liveMeeting.users2x).filter(u => !msg.body.except.toSet(u))
usersToLock foreach { utl =>
for {
uvo <- Users2x.setUserLocked(liveMeeting.users2x, utl.intId, msg.body.lock)
} yield {
log.info("Lock user. meetingId=" + props.meetingProp.intId + " userId=" + uvo.intId + " locked=" + uvo.locked)
val event = build(props.meetingProp.intId, uvo.intId, msg.body.lockedBy, uvo.locked)
outGW.send(event)
}
}
}
}

View File

@ -4,7 +4,9 @@ import org.bigbluebutton.core.running.MeetingActor
trait UsersApp2x trait UsersApp2x
extends UserLeaveReqMsgHdlr extends UserLeaveReqMsgHdlr
with LockUserInMeetingCmdMsgHdlr
with LockUsersInMeetingCmdMsgHdlr
with GetLockSettingsReqMsgHdlr
with ChangeUserEmojiCmdMsgHdlr { with ChangeUserEmojiCmdMsgHdlr {
this: MeetingActor => this: MeetingActor =>

View File

@ -242,6 +242,10 @@ class ReceivedJsonMsgHandlerActor(
routeGenericMsg[IsMeetingLockedReqMsg](envelope, jsonNode) routeGenericMsg[IsMeetingLockedReqMsg](envelope, jsonNode)
case ChangeLockSettingsInMeetingCmdMsg.NAME => case ChangeLockSettingsInMeetingCmdMsg.NAME =>
routeGenericMsg[ChangeLockSettingsInMeetingCmdMsg](envelope, jsonNode) routeGenericMsg[ChangeLockSettingsInMeetingCmdMsg](envelope, jsonNode)
case LockUsersInMeetingCmdMsg.NAME =>
routeGenericMsg[LockUsersInMeetingCmdMsg](envelope, jsonNode)
case GetLockSettingsReqMsg.NAME =>
routeGenericMsg[GetLockSettingsReqMsg](envelope, jsonNode)
// Screenshare // Screenshare
case ScreenshareRtmpBroadcastStartedVoiceConfEvtMsg.NAME => case ScreenshareRtmpBroadcastStartedVoiceConfEvtMsg.NAME =>

View File

@ -75,6 +75,7 @@ class MeetingActor(
with DestroyMeetingSysCmdMsgHdlr with DestroyMeetingSysCmdMsgHdlr
with SendTimeRemainingUpdateHdlr with SendTimeRemainingUpdateHdlr
with SendBreakoutTimeRemainingMsgHdlr with SendBreakoutTimeRemainingMsgHdlr
with ChangeLockSettingsInMeetingCmdMsgHdlr
with SyncGetMeetingInfoRespMsgHdlr { with SyncGetMeetingInfoRespMsgHdlr {
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) { override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
@ -239,6 +240,12 @@ class MeetingActor(
case m: LockLayoutMsg => handleLockLayoutMsg(m) case m: LockLayoutMsg => handleLockLayoutMsg(m)
case m: BroadcastLayoutMsg => handleBroadcastLayoutMsg(m) case m: BroadcastLayoutMsg => handleBroadcastLayoutMsg(m)
// Lock Settings
case m: ChangeLockSettingsInMeetingCmdMsg => handleSetLockSettings(m)
case m: LockUserInMeetingCmdMsg => handleLockUserInMeetingCmdMsg(m)
case m: LockUsersInMeetingCmdMsg => handleLockUsersInMeetingCmdMsg(m)
case m: GetLockSettingsReqMsg => handleGetLockSettingsReqMsg(m)
// Presentation // Presentation
case m: SetCurrentPresentationPubMsg => presentationApp2x.handleSetCurrentPresentationPubMsg(m) case m: SetCurrentPresentationPubMsg => presentationApp2x.handleSetCurrentPresentationPubMsg(m)
case m: GetPresentationInfoReqMsg => presentationApp2x.handleGetPresentationInfoReqMsg(m) case m: GetPresentationInfoReqMsg => presentationApp2x.handleGetPresentationInfoReqMsg(m)

View File

@ -9,7 +9,7 @@ trait ChangeLockSettingsInMeetingCmdMsgHdlr {
val outGW: OutMsgRouter val outGW: OutMsgRouter
def handleSetLockSettings(msg: ChangeLockSettingsInMeetingCmdMsg) { def handleSetLockSettings(msg: ChangeLockSettingsInMeetingCmdMsg): Unit = {
val settings = Permissions( val settings = Permissions(
disableCam = msg.body.disableCam, disableCam = msg.body.disableCam,
disableMic = msg.body.disableMic, disableMic = msg.body.disableMic,
@ -42,13 +42,27 @@ trait ChangeLockSettingsInMeetingCmdMsgHdlr {
val event = build(props.meetingProp.intId, msg.body.setBy, settings, msg.body.setBy) val event = build(props.meetingProp.intId, msg.body.setBy, settings, msg.body.setBy)
outGW.send(event) outGW.send(event)
/** processLockLayout(settings.lockedLayout, msg.body.setBy)
* outGW.send(new NewPermissionsSetting(props.meetingProp.intId, msg.setByUser,
* MeetingStatus2x.getPermissions(liveMeeting.status),
* Users2x.findAll(liveMeeting.users2x))
*
* handleLockLayout(msg.settings.lockedLayout, msg.setByUser)
*/
} }
} }
def processLockLayout(lock: Boolean, setBy: String): Unit = {
def broadcastEvent(lock: Boolean, setBy: String): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, setBy)
val envelope = BbbCoreEnvelope(LockLayoutEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(LockLayoutEvtMsg.NAME, liveMeeting.props.meetingProp.intId, setBy)
val body = LockLayoutEvtMsgBody(setBy, lock, affectedUsers)
val event = LockLayoutEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
}
liveMeeting.lockLayout(lock)
broadcastEvent(lock, setBy)
}
} }

View File

@ -172,6 +172,14 @@ object UserLockedInMeetingEvtMsg { val NAME = "UserLockedInMeetingEvtMsg" }
case class UserLockedInMeetingEvtMsg(header: BbbClientMsgHeader, body: UserLockedInMeetingEvtMsgBody) extends BbbCoreMsg case class UserLockedInMeetingEvtMsg(header: BbbClientMsgHeader, body: UserLockedInMeetingEvtMsgBody) extends BbbCoreMsg
case class UserLockedInMeetingEvtMsgBody(userId: String, locked: Boolean, lockedBy: String) case class UserLockedInMeetingEvtMsgBody(userId: String, locked: Boolean, lockedBy: String)
/**
* Sent by client to lock users.
*/
object LockUsersInMeetingCmdMsg { val NAME = "LockUsersInMeetingCmdMsg" }
case class LockUsersInMeetingCmdMsg(header: BbbClientMsgHeader, body: LockUsersInMeetingCmdMsgBody) extends StandardMsg
case class LockUsersInMeetingCmdMsgBody(lock: Boolean, lockedBy: String, except: Vector[String])
/** /**
* Sent by client to check if meeting is locked. * Sent by client to check if meeting is locked.
*/ */
@ -200,6 +208,23 @@ case class LockSettingsInMeetingChangedEvtMsgBody(disableCam: Boolean, disableMi
disablePubChat: Boolean, lockedLayout: Boolean, lockOnJoin: Boolean, disablePubChat: Boolean, lockedLayout: Boolean, lockOnJoin: Boolean,
lockOnJoinConfigurable: Boolean, setBy: String) lockOnJoinConfigurable: Boolean, setBy: String)
/**
* Sent by client to query the lock settings.
*/
object GetLockSettingsReqMsg { val NAME = "GetLockSettingsReqMsg" }
case class GetLockSettingsReqMsg(header: BbbClientMsgHeader, body: GetLockSettingsReqMsgBody) extends StandardMsg
case class GetLockSettingsReqMsgBody(requesterId: String)
/**
* Response to the query for lock settings.
*/
object GetLockSettingsRespMsg { val NAME = "GetLockSettingsRespMsg" }
case class GetLockSettingsRespMsg(header: BbbClientMsgHeader, body: GetLockSettingsRespMsgBody) extends BbbCoreMsg
case class GetLockSettingsRespMsgBody(disableCam: Boolean, disableMic: Boolean, disablePrivChat: Boolean,
disablePubChat: Boolean, lockedLayout: Boolean, lockOnJoin: Boolean,
lockOnJoinConfigurable: Boolean)
/** /**
* Sent from client to logout and end meeting. * Sent from client to logout and end meeting.
*/ */

View File

@ -139,10 +139,10 @@ package org.bigbluebutton.modules.users.services
case "user_listening_only": case "user_listening_only":
handleUserListeningOnly(message); handleUserListeningOnly(message);
break; break;
case "permissionsSettingsChanged": case "LockSettingsInMeetingChangedEvtMsg":
handlePermissionsSettingsChanged(message); handlePermissionsSettingsChanged(message);
break; break;
case "userLocked": case "UserLockedInMeetingEvtMsg":
handleUserLocked(message); handleUserLocked(message);
break; break;
// Breakout room feature // Breakout room feature
@ -455,12 +455,14 @@ package org.bigbluebutton.modules.users.services
} }
private function handleUserLocked(msg:Object):void { private function handleUserLocked(msg:Object):void {
var map:Object = JSON.parse(msg.msg); var body:Object = msg.body as Object;
var user:User2x = UsersUtil.getUser(map.user); var userId: String = body.userId as String;
var locked: Boolean = body.locked as Boolean;
var user:User2x = UsersUtil.getUser(userId);
if(user.locked != map.lock) { if(user.locked != locked) {
if (UsersUtil.isMe(user.intId)) { if (UsersUtil.isMe(user.intId)) {
LiveMeeting.inst().me.locked = map.locked; LiveMeeting.inst().me.locked = locked;
} }
dispatcher.dispatchEvent(new UserStatusChangedEvent(user.intId)); dispatcher.dispatchEvent(new UserStatusChangedEvent(user.intId));
@ -471,14 +473,16 @@ package org.bigbluebutton.modules.users.services
private function handlePermissionsSettingsChanged(msg:Object):void { private function handlePermissionsSettingsChanged(msg:Object):void {
//LOGGER.debug("handlePermissionsSettingsChanged {0} \n", [msg.msg]); //LOGGER.debug("handlePermissionsSettingsChanged {0} \n", [msg.msg]);
var map:Object = JSON.parse(msg.msg); var body:Object = msg.body as Object;
var lockSettings:LockSettingsVO = new LockSettingsVO(map.disableCam,
map.disableMic, var lockSettings:LockSettingsVO = new LockSettingsVO(
map.disablePrivateChat, body.disableCam as Boolean,
map.disablePublicChat, body.disableMic as Boolean,
map.lockedLayout, body.disablePrivChat as Boolean,
map.lockOnJoin, body.disablePubChat as Boolean,
map.lockOnJoinConfigurable); body.lockedLayout as Boolean,
body.lockOnJoin as Boolean,
body.lockOnJoinConfigurable as Boolean);
UsersUtil.setLockSettings(lockSettings); UsersUtil.setLockSettings(lockSettings);
} }

View File

@ -438,29 +438,24 @@ package org.bigbluebutton.modules.users.services
* Set lock state of all users in the room, except the users listed in second parameter * Set lock state of all users in the room, except the users listed in second parameter
* */ * */
public function setAllUsersLock(lock:Boolean, except:Array = null):void { public function setAllUsersLock(lock:Boolean, except:Array = null):void {
var message:Object = {
header: {name: "LockUsersInMeetingCmdMsg", meetingId: UsersUtil.getInternalMeetingID(),
userId: UsersUtil.getMyUserID()},
body: {lock: lock, lockedBy: UsersUtil.getMyUserID(), except: except}
};
return; var _nc:ConnectionManager = BBB.initConnectionManager();
/* _nc.sendMessage2x(
if(except == null) except = []; function(result:String):void { // On successful result
var nc:NetConnection = _module.connection;
nc.call(
"lock.setAllUsersLock",// Remote function name
new Responder(
function(result:Object):void {
LogUtil.debug("Successfully locked all users except " + except.join(","));
}, },
function(status:Object):void { function(status:String):void { // status - On error occurred
LogUtil.error("Error occurred:"); var logData:Object = UsersUtil.initLogData();
for (var x:Object in status) { logData.tags = ["apps"];
LogUtil.error(x + " : " + status[x]); logData.message = "Error occured setting user lock status.";
} LOGGER.info(JSON.stringify(logData));
} },
)//new Responder JSON.stringify(message)
, lock, except );
); //_netConnection.call
_listenersSO.send("lockStateCallback", lock);
*/
} }
/** /**
@ -485,47 +480,28 @@ package org.bigbluebutton.modules.users.services
}, },
JSON.stringify(message) JSON.stringify(message)
); );
/*
var nc:NetConnection = _module.connection;
nc.call(
"lock.setUserLock",// Remote function name
new Responder(
function(result:Object):void {
LogUtil.debug("Successfully locked user " + internalUserID);
},
function(status:Object):void {
LogUtil.error("Error occurred:");
for (var x:Object in status) {
LogUtil.error(x + " : " + status[x]);
}
}
)//new Responder
, lock, internalUserID
); //_netConnection.call
*/
} }
public function getLockSettings():void{ public function getLockSettings():void{
var message:Object = {
header: {name: "GetLockSettingsReqMsg", meetingId: UsersUtil.getInternalMeetingID(),
userId: UsersUtil.getMyUserID()},
body: {requesterId: UsersUtil.getMyUserID()}
};
return; var _nc:ConnectionManager = BBB.initConnectionManager();
/* _nc.sendMessage2x(
var nc:NetConnection = _module.connection; function(result:String):void { // On successful result
nc.call(
"lock.getLockSettings",// Remote function name
new Responder(
function(result:Object):void {
// _conference.setLockSettings(new LockSettingsVO(result.allowModeratorLocking, result.disableCam, result.disableMic, result.disablePrivateChat, result.disablePublicChat));
}, },
function(status:Object):void { function(status:String):void { // status - On error occurred
LogUtil.error("Error occurred:"); var logData:Object = UsersUtil.initLogData();
for (var x:Object in status) { logData.tags = ["apps"];
LogUtil.error(x + " : " + status[x]); logData.message = "Error occured getting lock state.";
} LOGGER.info(JSON.stringify(logData));
} },
)//new Responder JSON.stringify(message)
); //_netConnection.call );
*/
} }
public function saveLockSettings(newLockSettings:Object):void{ public function saveLockSettings(newLockSettings:Object):void{
@ -533,12 +509,14 @@ package org.bigbluebutton.modules.users.services
var message:Object = { var message:Object = {
header: {name: "ChangeLockSettingsInMeetingCmdMsg", meetingId: UsersUtil.getInternalMeetingID(), header: {name: "ChangeLockSettingsInMeetingCmdMsg", meetingId: UsersUtil.getInternalMeetingID(),
userId: UsersUtil.getMyUserID()}, userId: UsersUtil.getMyUserID()},
body: {disableCam: newLockSettings.disableCam, disableMic: newLockSettings.disableMic, body: {disableCam: newLockSettings.disableCam,
disableMic: newLockSettings.disableMic,
disablePrivChat: newLockSettings.disablePrivateChat, disablePrivChat: newLockSettings.disablePrivateChat,
disablePubChat: newLockSettings.disablePublicChat, disablePubChat: newLockSettings.disablePublicChat,
lockedLayout: newLockSettings.lockedLayout, lockOnJoin: newLockSettings.lockOnJoin, lockedLayout: newLockSettings.lockedLayout,
lockOnJoin: newLockSettings.lockOnJoin,
lockOnJoinConfigurable: newLockSettings.lockOnJoinConfigurable, lockOnJoinConfigurable: newLockSettings.lockOnJoinConfigurable,
changedBy: UsersUtil.getMyUserID()} setBy: UsersUtil.getMyUserID()}
}; };