From 32375f1c66972c7eabaf4f9a147feb1b6a6bdd68 Mon Sep 17 00:00:00 2001 From: Chad Pilkey Date: Fri, 15 Dec 2017 19:47:06 -0500 Subject: [PATCH] add check for currentPresenter in pod message handlers --- .../core/apps/presentationpod/PresentationPodsApp.scala | 9 +++++++++ .../presentationpod/ResizeAndMovePagePubMsgHdlr.scala | 5 ++--- .../apps/presentationpod/SetCurrentPagePubMsgHdlr.scala | 2 +- .../SetCurrentPresentationPubMsgHdlr.scala | 6 ++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala index c39730832a..ef8e6c2d8b 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala @@ -25,6 +25,15 @@ object PresentationPodsApp { state.presentationPodManager.getPod(podId) } + def getPresentationPodIfPresenter(state: MeetingState2x, podId: String, userId: String): Option[PresentationPod] = { + for { + pod <- getPresentationPod(state, podId) + if pod.currentPresenter == userId + } yield { + pod + } + } + def getAllPresentationPodsInMeeting(state: MeetingState2x): Vector[PresentationPod] = { state.presentationPodManager.getAllPresentationPodsInMeeting() } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/ResizeAndMovePagePubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/ResizeAndMovePagePubMsgHdlr.scala index fd2e286c41..eb77c7a1b8 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/ResizeAndMovePagePubMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/ResizeAndMovePagePubMsgHdlr.scala @@ -47,9 +47,8 @@ trait ResizeAndMovePagePubMsgHdlr extends RightsManagementTrait { val heightRatio: Double = msg.body.heightRatio val newState = for { - pod <- PresentationPodsApp.getPresentationPod(state, podId) - (updatedPod, page) <- pod.resizePage(presentationId, pageId, - xOffset, yOffset, widthRatio, heightRatio) + pod <- PresentationPodsApp.getPresentationPodIfPresenter(state, podId, msg.header.userId) + (updatedPod, page) <- pod.resizePage(presentationId, pageId, xOffset, yOffset, widthRatio, heightRatio) } yield { broadcastEvent(msg, podId, page) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPagePubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPagePubMsgHdlr.scala index 4bc0ded22e..3a3ff517f6 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPagePubMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPagePubMsgHdlr.scala @@ -42,7 +42,7 @@ trait SetCurrentPagePubMsgHdlr extends RightsManagementTrait { val pageId = msg.body.pageId val newState = for { - pod <- PresentationPodsApp.getPresentationPod(state, podId) + pod <- PresentationPodsApp.getPresentationPodIfPresenter(state, podId, userId) updatedPod <- pod.setCurrentPage(presentationId, pageId) } yield { diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPresentationPubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPresentationPubMsgHdlr.scala index 7de41a8da2..d25cf9e8b8 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPresentationPubMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPresentationPubMsgHdlr.scala @@ -34,11 +34,13 @@ trait SetCurrentPresentationPubMsgHdlr extends RightsManagementTrait { val podId = msg.body.podId val presId = msg.body.presentationId + val userId = msg.header.userId val newState = for { - updatedPod <- PresentationPodsApp.setCurrentPresentationInPod(state, podId, presId) + pod <- PresentationPodsApp.getPresentationPodIfPresenter(state, podId, userId) + updatedPod <- pod.setCurrentPresentation(presId) } yield { - broadcastSetCurrentPresentationEvent(podId, msg.header.userId, presId) + broadcastSetCurrentPresentationEvent(podId, userId, presId) val pods = state.presentationPodManager.addPod(updatedPod) state.update(pods)