- 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
def handle(msg: LockUserInMeetingCmdMsg) {
def handleLockUserInMeetingCmdMsg(msg: LockUserInMeetingCmdMsg) {
def build(meetingId: String, userId: String, lockedBy: String, locked: Boolean): BbbCommonEnvCoreMsg = {
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
extends UserLeaveReqMsgHdlr
with LockUserInMeetingCmdMsgHdlr
with LockUsersInMeetingCmdMsgHdlr
with GetLockSettingsReqMsgHdlr
with ChangeUserEmojiCmdMsgHdlr {
this: MeetingActor =>

View File

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

View File

@ -75,6 +75,7 @@ class MeetingActor(
with DestroyMeetingSysCmdMsgHdlr
with SendTimeRemainingUpdateHdlr
with SendBreakoutTimeRemainingMsgHdlr
with ChangeLockSettingsInMeetingCmdMsgHdlr
with SyncGetMeetingInfoRespMsgHdlr {
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
@ -239,6 +240,12 @@ class MeetingActor(
case m: LockLayoutMsg => handleLockLayoutMsg(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
case m: SetCurrentPresentationPubMsg => presentationApp2x.handleSetCurrentPresentationPubMsg(m)
case m: GetPresentationInfoReqMsg => presentationApp2x.handleGetPresentationInfoReqMsg(m)

View File

@ -9,7 +9,7 @@ trait ChangeLockSettingsInMeetingCmdMsgHdlr {
val outGW: OutMsgRouter
def handleSetLockSettings(msg: ChangeLockSettingsInMeetingCmdMsg) {
def handleSetLockSettings(msg: ChangeLockSettingsInMeetingCmdMsg): Unit = {
val settings = Permissions(
disableCam = msg.body.disableCam,
disableMic = msg.body.disableMic,
@ -42,13 +42,27 @@ trait ChangeLockSettingsInMeetingCmdMsgHdlr {
val event = build(props.meetingProp.intId, msg.body.setBy, settings, msg.body.setBy)
outGW.send(event)
/**
* outGW.send(new NewPermissionsSetting(props.meetingProp.intId, msg.setByUser,
* MeetingStatus2x.getPermissions(liveMeeting.status),
* Users2x.findAll(liveMeeting.users2x))
*
* handleLockLayout(msg.settings.lockedLayout, msg.setByUser)
*/
processLockLayout(settings.lockedLayout, msg.body.setBy)
}
}
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 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.
*/
@ -200,6 +208,23 @@ case class LockSettingsInMeetingChangedEvtMsgBody(disableCam: Boolean, disableMi
disablePubChat: Boolean, lockedLayout: Boolean, lockOnJoin: Boolean,
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.
*/

View File

@ -544,7 +544,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mx:Label id="meetingNameLbl" minWidth="1" styleName="meetingNameLabelStyle" />
<mx:HBox id="addedBtns" width="100%" horizontalAlign="center"/>
<mx:Label id="timeRemainingLabel" visible="false"
text="{ResourceUtil.getInstance().getString('bbb.meeting.timeRemaining')}: "
text="{ResourceUtil.getInstance().getString('bbb.meeting.timeRemaining')}:"
toolTip="{ResourceUtil.getInstance().getString('bbb.meeting.timeRemaining')}"/>
<mx:Label id="timeRemaining" visible="false"
text="{ResourceUtil.getInstance().getString('bbb.users.breakout.calculatingRemainingTime')}"

View File

@ -139,10 +139,10 @@ package org.bigbluebutton.modules.users.services
case "user_listening_only":
handleUserListeningOnly(message);
break;
case "permissionsSettingsChanged":
case "LockSettingsInMeetingChangedEvtMsg":
handlePermissionsSettingsChanged(message);
break;
case "userLocked":
case "UserLockedInMeetingEvtMsg":
handleUserLocked(message);
break;
// Breakout room feature
@ -455,12 +455,14 @@ package org.bigbluebutton.modules.users.services
}
private function handleUserLocked(msg:Object):void {
var map:Object = JSON.parse(msg.msg);
var user:User2x = UsersUtil.getUser(map.user);
var body:Object = msg.body as Object;
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)) {
LiveMeeting.inst().me.locked = map.locked;
LiveMeeting.inst().me.locked = locked;
}
dispatcher.dispatchEvent(new UserStatusChangedEvent(user.intId));
@ -471,14 +473,16 @@ package org.bigbluebutton.modules.users.services
private function handlePermissionsSettingsChanged(msg:Object):void {
//LOGGER.debug("handlePermissionsSettingsChanged {0} \n", [msg.msg]);
var map:Object = JSON.parse(msg.msg);
var lockSettings:LockSettingsVO = new LockSettingsVO(map.disableCam,
map.disableMic,
map.disablePrivateChat,
map.disablePublicChat,
map.lockedLayout,
map.lockOnJoin,
map.lockOnJoinConfigurable);
var body:Object = msg.body as Object;
var lockSettings:LockSettingsVO = new LockSettingsVO(
body.disableCam as Boolean,
body.disableMic as Boolean,
body.disablePrivChat as Boolean,
body.disablePubChat as Boolean,
body.lockedLayout as Boolean,
body.lockOnJoin as Boolean,
body.lockOnJoinConfigurable as Boolean);
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
* */
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;
/*
if(except == null) except = [];
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 {
LogUtil.error("Error occurred:");
for (var x:Object in status) {
LogUtil.error(x + " : " + status[x]);
}
}
)//new Responder
, lock, except
); //_netConnection.call
_listenersSO.send("lockStateCallback", lock);
*/
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage2x(
function(result:String):void { // On successful result
},
function(status:String):void { // status - On error occurred
var logData:Object = UsersUtil.initLogData();
logData.tags = ["apps"];
logData.message = "Error occured setting user lock status.";
LOGGER.info(JSON.stringify(logData));
},
JSON.stringify(message)
);
}
/**
@ -473,59 +468,40 @@ package org.bigbluebutton.modules.users.services
body: {userId: internalUserID, lock: lock, lockedBy: UsersUtil.getMyUserID()}
};
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage2x(
function(result:String):void { // On successful result
},
function(status:String):void { // status - On error occurred
var logData:Object = UsersUtil.initLogData();
logData.tags = ["apps"];
logData.message = "Error occured setting user lock status.";
LOGGER.info(JSON.stringify(logData));
},
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
*/
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage2x(
function(result:String):void { // On successful result
},
function(status:String):void { // status - On error occurred
var logData:Object = UsersUtil.initLogData();
logData.tags = ["apps"];
logData.message = "Error occured setting user lock status.";
LOGGER.info(JSON.stringify(logData));
},
JSON.stringify(message)
);
}
public function getLockSettings():void{
var message:Object = {
header: {name: "GetLockSettingsReqMsg", meetingId: UsersUtil.getInternalMeetingID(),
userId: UsersUtil.getMyUserID()},
body: {requesterId: UsersUtil.getMyUserID()}
};
return;
/*
var nc:NetConnection = _module.connection;
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 {
LogUtil.error("Error occurred:");
for (var x:Object in status) {
LogUtil.error(x + " : " + status[x]);
}
}
)//new Responder
); //_netConnection.call
*/
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage2x(
function(result:String):void { // On successful result
},
function(status:String):void { // status - On error occurred
var logData:Object = UsersUtil.initLogData();
logData.tags = ["apps"];
logData.message = "Error occured getting lock state.";
LOGGER.info(JSON.stringify(logData));
},
JSON.stringify(message)
);
}
public function saveLockSettings(newLockSettings:Object):void{
@ -533,12 +509,14 @@ package org.bigbluebutton.modules.users.services
var message:Object = {
header: {name: "ChangeLockSettingsInMeetingCmdMsg", meetingId: UsersUtil.getInternalMeetingID(),
userId: UsersUtil.getMyUserID()},
body: {disableCam: newLockSettings.disableCam, disableMic: newLockSettings.disableMic,
body: {disableCam: newLockSettings.disableCam,
disableMic: newLockSettings.disableMic,
disablePrivChat: newLockSettings.disablePrivateChat,
disablePubChat: newLockSettings.disablePublicChat,
lockedLayout: newLockSettings.lockedLayout, lockOnJoin: newLockSettings.lockOnJoin,
lockedLayout: newLockSettings.lockedLayout,
lockOnJoin: newLockSettings.lockOnJoin,
lockOnJoinConfigurable: newLockSettings.lockOnJoinConfigurable,
changedBy: UsersUtil.getMyUserID()}
setBy: UsersUtil.getMyUserID()}
};