diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/GetLockSettingsReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/GetLockSettingsReqMsgHdlr.scala new file mode 100755 index 0000000000..63174a04a5 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/GetLockSettingsReqMsgHdlr.scala @@ -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) + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/LockUserInMeetingCmdMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/LockUserInMeetingCmdMsgHdlr.scala index a34ad40b13..aca476f3fc 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/LockUserInMeetingCmdMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/LockUserInMeetingCmdMsgHdlr.scala @@ -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) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/LockUsersInMeetingCmdMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/LockUsersInMeetingCmdMsgHdlr.scala new file mode 100755 index 0000000000..9cbceb7c04 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/LockUsersInMeetingCmdMsgHdlr.scala @@ -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) + } + } + + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala index 389ac48df1..9292b2f22a 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala @@ -4,7 +4,9 @@ import org.bigbluebutton.core.running.MeetingActor trait UsersApp2x extends UserLeaveReqMsgHdlr - + with LockUserInMeetingCmdMsgHdlr + with LockUsersInMeetingCmdMsgHdlr + with GetLockSettingsReqMsgHdlr with ChangeUserEmojiCmdMsgHdlr { this: MeetingActor => diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala index 2ef6d19c05..d25a1ab592 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala @@ -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 => diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala index 2a42feb800..23d857bede 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala @@ -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) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/ChangeLockSettingsInMeetingCmdMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/ChangeLockSettingsInMeetingCmdMsgHdlr.scala index 737793e1e4..1fa40bdc16 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/ChangeLockSettingsInMeetingCmdMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/ChangeLockSettingsInMeetingCmdMsgHdlr.scala @@ -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) + + } } diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala index 6176fb5e86..93c3978fc1 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala @@ -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. */ diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml index 14db08df55..b14afbf162 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml @@ -544,7 +544,7 @@ with BigBlueButton; if not, see .