Merge pull request #4 from GuiLeme/I-18137-back-end-tweak
[I-18101-back-end-tweak] - back-end portion - review changes
This commit is contained in:
commit
29be67e226
@ -9,14 +9,7 @@ trait CreateTimerPubMsgHdlr extends RightsManagementTrait {
|
|||||||
this: TimerApp2x =>
|
this: TimerApp2x =>
|
||||||
|
|
||||||
def handle(msg: CreateTimerPubMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
|
def handle(msg: CreateTimerPubMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
|
||||||
val isTimerFeatureEnabled: Boolean = !liveMeeting.props.meetingProp.disabledFeatures.contains("timer")
|
log.debug("Received CreateTimerPubMsg {}", CreateTimerPubMsg)
|
||||||
|
TimerModel.createTimer(liveMeeting.timerModel, msg.body.stopwatch, msg.body.time, msg.body.accumulated, msg.body.track)
|
||||||
if (!isTimerFeatureEnabled) {
|
|
||||||
log.error("Timer feature is disabled for meeting {}, meetingId={}", liveMeeting.props.meetingProp.name,
|
|
||||||
liveMeeting.props.meetingProp.intId)
|
|
||||||
} else {
|
|
||||||
log.debug("Received CreateTimerPubMsg {}", CreateTimerPubMsg)
|
|
||||||
TimerModel.createTimer(liveMeeting.timerModel, msg.body.stopwatch, msg.body.time, msg.body.accumulated, msg.body.track)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,21 +23,14 @@ trait DeactivateTimerReqMsgHdlr extends RightsManagementTrait {
|
|||||||
bus.outGW.send(msgEvent)
|
bus.outGW.send(msgEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
val isTimerFeatureEnabled: Boolean = !liveMeeting.props.meetingProp.disabledFeatures.contains("timer")
|
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
||||||
|
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
|
||||||
if (!isTimerFeatureEnabled) {
|
val meetingId = liveMeeting.props.meetingProp.intId
|
||||||
log.error("Timer feature is disabled for meeting {}, meetingId={}", liveMeeting.props.meetingProp.name,
|
val reason = "You need to be the presenter or moderator to deactivate timer"
|
||||||
liveMeeting.props.meetingProp.intId)
|
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
||||||
} else {
|
} else {
|
||||||
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
TimerModel.setIsActive(liveMeeting.timerModel, false);
|
||||||
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
|
broadcastEvent()
|
||||||
val meetingId = liveMeeting.props.meetingProp.intId
|
|
||||||
val reason = "You need to be the presenter or moderator to deactivate timer"
|
|
||||||
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
|
||||||
} else {
|
|
||||||
TimerModel.setIsActive(liveMeeting.timerModel, false);
|
|
||||||
broadcastEvent()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,22 +23,13 @@ trait ResetTimerReqMsgHdlr extends RightsManagementTrait {
|
|||||||
bus.outGW.send(msgEvent)
|
bus.outGW.send(msgEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
val isTimerFeatureEnabled: Boolean = !liveMeeting.props.meetingProp.disabledFeatures.contains("timer")
|
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
||||||
|
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
|
||||||
if (!isTimerFeatureEnabled) {
|
val meetingId = liveMeeting.props.meetingProp.intId
|
||||||
log.error(
|
val reason = "You need to be the presenter or moderator to reset timer"
|
||||||
"Timer feature is disabled for meeting {}, meetingId={}",
|
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
||||||
liveMeeting.props.meetingProp.name, liveMeeting.props.meetingProp.intId
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
broadcastEvent()
|
||||||
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
|
|
||||||
val meetingId = liveMeeting.props.meetingProp.intId
|
|
||||||
val reason = "You need to be the presenter or moderator to reset timer"
|
|
||||||
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
|
||||||
} else {
|
|
||||||
broadcastEvent()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,23 +25,14 @@ trait SetTimerReqMsgHdlr extends RightsManagementTrait {
|
|||||||
bus.outGW.send(msgEvent)
|
bus.outGW.send(msgEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
val isTimerFeatureEnabled: Boolean = !liveMeeting.props.meetingProp.disabledFeatures.contains("timer")
|
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
||||||
|
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
|
||||||
if (!isTimerFeatureEnabled) {
|
val meetingId = liveMeeting.props.meetingProp.intId
|
||||||
log.error(
|
val reason = "You need to be the presenter or moderator to set timer"
|
||||||
"Timer feature is disabled for meeting {}, meetingId={}",
|
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
||||||
liveMeeting.props.meetingProp.name, liveMeeting.props.meetingProp.intId
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
TimerModel.setTime(liveMeeting.timerModel, msg.body.time)
|
||||||
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
|
broadcastEvent(msg.body.time)
|
||||||
val meetingId = liveMeeting.props.meetingProp.intId
|
|
||||||
val reason = "You need to be the presenter or moderator to set timer"
|
|
||||||
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
|
||||||
} else {
|
|
||||||
TimerModel.setTime(liveMeeting.timerModel, msg.body.time)
|
|
||||||
broadcastEvent(msg.body.time)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,23 +25,14 @@ trait SetTrackReqMsgHdlr extends RightsManagementTrait {
|
|||||||
bus.outGW.send(msgEvent)
|
bus.outGW.send(msgEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
val isTimerFeatureEnabled: Boolean = !liveMeeting.props.meetingProp.disabledFeatures.contains("timer")
|
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
||||||
|
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
|
||||||
if (!isTimerFeatureEnabled) {
|
val meetingId = liveMeeting.props.meetingProp.intId
|
||||||
log.error(
|
val reason = "You need to be the presenter or moderator to set track"
|
||||||
"Timer feature is disabled for meeting {}, meetingId={}",
|
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
||||||
liveMeeting.props.meetingProp.name, liveMeeting.props.meetingProp.intId
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
TimerModel.setTrack(liveMeeting.timerModel, msg.body.track)
|
||||||
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
|
broadcastEvent(msg.body.track)
|
||||||
val meetingId = liveMeeting.props.meetingProp.intId
|
|
||||||
val reason = "You need to be the presenter or moderator to set track"
|
|
||||||
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
|
||||||
} else {
|
|
||||||
TimerModel.setTrack(liveMeeting.timerModel, msg.body.track)
|
|
||||||
broadcastEvent(msg.body.track)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,22 +23,15 @@ trait StartTimerReqMsgHdlr extends RightsManagementTrait {
|
|||||||
bus.outGW.send(msgEvent)
|
bus.outGW.send(msgEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
val isTimerFeatureEnabled: Boolean = !liveMeeting.props.meetingProp.disabledFeatures.contains("timer")
|
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
||||||
|
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
|
||||||
if (!isTimerFeatureEnabled) {
|
val meetingId = liveMeeting.props.meetingProp.intId
|
||||||
log.error("Timer feature is disabled for meeting {}, meetingId={}", liveMeeting.props.meetingProp.name,
|
val reason = "You need to be the presenter or moderator to start timer"
|
||||||
liveMeeting.props.meetingProp.intId)
|
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
||||||
} else {
|
} else {
|
||||||
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
TimerModel.setStartedAt(liveMeeting.timerModel, System.currentTimeMillis())
|
||||||
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
|
TimerModel.setRunning(liveMeeting.timerModel, true)
|
||||||
val meetingId = liveMeeting.props.meetingProp.intId
|
broadcastEvent()
|
||||||
val reason = "You need to be the presenter or moderator to start timer"
|
|
||||||
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
|
||||||
} else {
|
|
||||||
TimerModel.setStartedAt(liveMeeting.timerModel, System.currentTimeMillis())
|
|
||||||
TimerModel.setRunning(liveMeeting.timerModel, true)
|
|
||||||
broadcastEvent()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,23 +25,16 @@ trait StopTimerReqMsgHdlr extends RightsManagementTrait {
|
|||||||
bus.outGW.send(msgEvent)
|
bus.outGW.send(msgEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
val isTimerFeatureEnabled: Boolean = !liveMeeting.props.meetingProp.disabledFeatures.contains("timer")
|
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
||||||
|
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
||||||
if (!isTimerFeatureEnabled) {
|
msg.header.userId != "nodeJSapp") {
|
||||||
log.error("Timer feature is disabled for meeting {}, meetingId={}", liveMeeting.props.meetingProp.name,
|
val meetingId = liveMeeting.props.meetingProp.intId
|
||||||
liveMeeting.props.meetingProp.intId)
|
val reason = "You need to be the presenter or moderator to stop timer"
|
||||||
|
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
||||||
} else {
|
} else {
|
||||||
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
TimerModel.setAccumulated(liveMeeting.timerModel, msg.body.accumulated)
|
||||||
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
TimerModel.setRunning(liveMeeting.timerModel, false)
|
||||||
msg.header.userId != "nodeJSapp") {
|
broadcastEvent(msg.body.accumulated)
|
||||||
val meetingId = liveMeeting.props.meetingProp.intId
|
|
||||||
val reason = "You need to be the presenter or moderator to stop timer"
|
|
||||||
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
|
||||||
} else {
|
|
||||||
TimerModel.setAccumulated(liveMeeting.timerModel, msg.body.accumulated)
|
|
||||||
TimerModel.setRunning(liveMeeting.timerModel, false)
|
|
||||||
broadcastEvent(msg.body.accumulated)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,24 +25,17 @@ trait SwitchTimerReqMsgHdlr extends RightsManagementTrait {
|
|||||||
bus.outGW.send(msgEvent)
|
bus.outGW.send(msgEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
val isTimerFeatureEnabled: Boolean = !liveMeeting.props.meetingProp.disabledFeatures.contains("timer")
|
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
||||||
|
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
|
||||||
if (!isTimerFeatureEnabled) {
|
val meetingId = liveMeeting.props.meetingProp.intId
|
||||||
log.error("Timer feature is disabled for meeting {}, meetingId={}", liveMeeting.props.meetingProp.name,
|
val reason = "You need to be the presenter or moderator to switch timer"
|
||||||
liveMeeting.props.meetingProp.intId)
|
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
||||||
} else {
|
} else {
|
||||||
if (permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId) &&
|
if (TimerModel.getStopwatch(liveMeeting.timerModel) != msg.body.stopwatch) {
|
||||||
permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.PRESENTER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
|
TimerModel.setStopwatch(liveMeeting.timerModel, msg.body.stopwatch)
|
||||||
val meetingId = liveMeeting.props.meetingProp.intId
|
broadcastEvent(msg.body.stopwatch)
|
||||||
val reason = "You need to be the presenter or moderator to switch timer"
|
|
||||||
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
|
|
||||||
} else {
|
} else {
|
||||||
if (TimerModel.getStopwatch(liveMeeting.timerModel) != msg.body.stopwatch) {
|
log.debug("Timer is already in this stopwatch mode");
|
||||||
TimerModel.setStopwatch(liveMeeting.timerModel, msg.body.stopwatch)
|
|
||||||
broadcastEvent(msg.body.stopwatch)
|
|
||||||
} else {
|
|
||||||
log.debug("Timer is already in this stopwatch mode");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user