diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ChangeUserEmojiCmdMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ChangeUserEmojiCmdMsgHdlr.scala index b156f9b011..f09565362c 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ChangeUserEmojiCmdMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ChangeUserEmojiCmdMsgHdlr.scala @@ -12,16 +12,28 @@ trait ChangeUserEmojiCmdMsgHdlr extends RightsManagementTrait { val outGW: OutMsgRouter def handleChangeUserEmojiCmdMsg(msg: ChangeUserEmojiCmdMsg) { - if (msg.header.userId != msg.body.userId && permissionFailed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId)) { - val meetingId = liveMeeting.props.meetingProp.intId - val reason = "No permission to clear change user emoji status." - PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, outGW, liveMeeting) - } else { + + val isUserSettingOwnEmoji = (msg.header.userId == msg.body.userId) + + val isUserModerator = !permissionFailed( + PermissionCheck.MOD_LEVEL, + PermissionCheck.VIEWER_LEVEL, + liveMeeting.users2x, + msg.header.userId + ) + + if (isUserSettingOwnEmoji + || (isUserModerator && msg.body.emoji == "none") // Moderator is clearing status icons + ) { for { uvo <- Users2x.setEmojiStatus(liveMeeting.users2x, msg.body.userId, msg.body.emoji) } yield { sendUserEmojiChangedEvtMsg(outGW, liveMeeting.props.meetingProp.intId, msg.body.userId, msg.body.emoji) } + } else { + val meetingId = liveMeeting.props.meetingProp.intId + val reason = "No permission to clear change user emoji status." + PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, outGW, liveMeeting) } }