Do not ban users ejecting self from meeting

Some users join with multiple browsers. When user is ejecting self from one browser,
 do not eject all sessions for that user and do not prevent them from rejoining.
This commit is contained in:
Richard Alam 2020-04-24 07:14:50 -07:00
parent 43d9c3da98
commit 58fed45754
3 changed files with 38 additions and 12 deletions

View File

@ -30,15 +30,29 @@ trait EjectUserFromMeetingCmdMsgHdlr extends RightsManagementTrait {
val reason = "user ejected by another user"
for {
registeredUser <- RegisteredUsers.findWithUserId(userId, liveMeeting.registeredUsers)
ejectedByUser <- RegisteredUsers.findWithUserId(ejectedBy, liveMeeting.registeredUsers)
} yield {
if (registeredUser.externId != ejectedByUser.externId) {
// Eject users
println("****************** User " + ejectedBy + " ejecting user " + userId)
// User might have joined using multiple browsers.
// Hunt down all registered users based on extern userid and eject them all.
// ralam april 21, 2020
RegisteredUsers.findAllWithExternUserId(registeredUser.externId, liveMeeting.registeredUsers) foreach { ru =>
println("****************** User " + ejectedBy + " ejecting other user " + ru.id)
UsersApp.ejectUserFromMeeting(outGW, liveMeeting, ru.id, ejectedBy, reason, EjectReasonCode.EJECT_USER)
// send a system message to force disconnection
Sender.sendDisconnectClientSysMsg(meetingId, ru.id, ejectedBy, EjectReasonCode.EJECT_USER, outGW)
}
} else {
// User is ejecting self, so just eject this userid not all sessions if joined using multiple
// browsers. ralam april 23, 2020
println("****************** User " + ejectedBy + " ejecting self " + userId)
UsersApp.ejectUserFromMeeting(outGW, liveMeeting, userId, ejectedBy, reason, EjectReasonCode.EJECT_USER)
// send a system message to force disconnection
Sender.sendDisconnectClientSysMsg(meetingId, userId, ejectedBy, EjectReasonCode.EJECT_USER, outGW)
}
}
}
}

View File

@ -93,7 +93,7 @@ object UsersApp {
for {
user <- Users2x.ejectFromMeeting(liveMeeting.users2x, userId)
reguser <- RegisteredUsers.remove(userId, liveMeeting.registeredUsers)
reguser <- RegisteredUsers.eject(userId, liveMeeting.registeredUsers, ejectedBy)
} yield {
sendUserEjectedMessageToClient(outGW, meetingId, userId, ejectedBy, reason, reasonCode)
sendUserLeftMeetingToAllClients(outGW, meetingId, userId)

View File

@ -81,17 +81,29 @@ object RegisteredUsers {
}
def remove(id: String, users: RegisteredUsers): Option[RegisteredUser] = {
for {
ru <- findWithUserId(id, users)
} yield {
private def banUser(ejectedUser: RegisteredUser, users: RegisteredUsers, ejectedByUser: RegisteredUser): RegisteredUser = {
// Some users join with multiple browser to manage the meeting.
// Don't black list a user ejecting oneself.
// ralam april 23, 2020
if (ejectedUser.externId != ejectedByUser.externId) {
// Set a flag that user has been ejected. We flag the user instead of
// removing so we can eject when user tries to rejoin with the same
// external userid.
// ralam april 21, 2020
val u = ru.modify(_.ejected).setTo(true)
val u = ejectedUser.modify(_.ejected).setTo(true)
users.save(u)
u
} else {
users.delete(ejectedUser.id)
ejectedUser
}
}
def eject(id: String, users: RegisteredUsers, ejectedBy: String): Option[RegisteredUser] = {
for {
ru <- findWithUserId(id, users)
eu <- findWithUserId(ejectedBy, users)
} yield {
banUser(ru, users, eu)
}
}