- filter delayed presentation messages after swithching presenter

This commit is contained in:
Richard Alam 2017-11-22 14:10:33 -08:00
parent ace9fdd2b7
commit 3a29ecdc49
8 changed files with 23 additions and 16 deletions

View File

@ -24,6 +24,15 @@ trait RightsManagementTrait extends SystemConfiguration {
false
}
}
def filterPresentationMessage(users: Users2x, userId: String): Boolean = {
users.purgeOldPresenters()
val now = System.currentTimeMillis()
users.findOldPresenter(userId) match {
case Some(op) => now - op.changedPresenterOn < 5000
case None => false
}
}
}
object PermissionCheck {
@ -87,12 +96,4 @@ object PermissionCheck {
users.removeOldPresenter(userId)
}
def isDelayedMessage(users: Users2x, userId: String): Boolean = {
users.purgeOldPresenters()
val now = System.currentTimeMillis()
users.findOldPresenter(userId) match {
case Some(op) => now - op.notPresenterOn < 5000
case None => false
}
}
}

View File

@ -65,7 +65,8 @@ trait PresentationUploadTokenReqMsgHdlr extends RightsManagementTrait {
log.info("handlePresentationUploadTokenReqMsg" + liveMeeting.props.meetingProp.intId +
" userId=" + msg.header.userId + " filename=" + msg.body.filename)
if (permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
if (filterPresentationMessage(liveMeeting.users2x, msg.header.userId) &&
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
val meetingId = liveMeeting.props.meetingProp.intId
val reason = "No permission to request presentation upload token."
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)

View File

@ -12,7 +12,8 @@ trait RemovePresentationPodPubMsgHdlr extends RightsManagementTrait {
def handle(msg: RemovePresentationPodPubMsg, state: MeetingState2x,
liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = {
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
if (filterPresentationMessage(liveMeeting.users2x, msg.header.userId) &&
permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
val meetingId = liveMeeting.props.meetingProp.intId
val reason = "No permission to remove presentation pod from meeting."
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)

View File

@ -14,7 +14,8 @@ trait RemovePresentationPubMsgHdlr extends RightsManagementTrait {
liveMeeting: LiveMeeting, bus: MessageBus
): MeetingState2x = {
if (permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
if (filterPresentationMessage(liveMeeting.users2x, msg.header.userId) &&
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
val meetingId = liveMeeting.props.meetingProp.intId
val reason = "No permission to remove presentation from meeting."
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)

View File

@ -31,7 +31,8 @@ trait ResizeAndMovePagePubMsgHdlr extends RightsManagementTrait {
bus.outGW.send(msgEvent)
}
if (permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
if (filterPresentationMessage(liveMeeting.users2x, msg.header.userId) &&
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
val meetingId = liveMeeting.props.meetingProp.intId
val reason = "No permission to resize and move page."
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)

View File

@ -15,7 +15,8 @@ trait SetCurrentPagePubMsgHdlr extends RightsManagementTrait {
liveMeeting: LiveMeeting, bus: MessageBus
): MeetingState2x = {
if (permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
if (filterPresentationMessage(liveMeeting.users2x, msg.header.userId) &&
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
val meetingId = liveMeeting.props.meetingProp.intId
val reason = "No permission to set current presentation page."
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)

View File

@ -14,7 +14,8 @@ trait SetCurrentPresentationPubMsgHdlr extends RightsManagementTrait {
liveMeeting: LiveMeeting, bus: MessageBus
): MeetingState2x = {
if (permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
if (filterPresentationMessage(liveMeeting.users2x, msg.header.userId) &&
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
val meetingId = liveMeeting.props.meetingProp.intId
val reason = "No permission to change current presentation."
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)

View File

@ -197,14 +197,14 @@ class Users2x {
def purgeOldPresenters(): Unit = {
val now = System.currentTimeMillis()
oldPresenterGroup.values.foreach { op =>
if (now - op.notPresenterOn < 5000) {
if (now - op.changedPresenterOn < 5000) {
oldPresenterGroup -= op.userId
}
}
}
}
case class OldPresenter(userId: String, notPresenterOn: Long)
case class OldPresenter(userId: String, changedPresenterOn: Long)
case class UserState(intId: String, extId: String, name: String, role: String,
guest: Boolean, authed: Boolean, guestStatus: String, emoji: String, locked: Boolean,