Merge pull request #19175 from gustavotrott/param-enforceLayout

feature: Add new API join param: enforceLayout
This commit is contained in:
Gustavo Trott 2023-11-20 17:09:20 -03:00 committed by GitHub
commit a60a77584b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 73 additions and 38 deletions

View File

@ -60,7 +60,8 @@ trait RegisterUserReqMsgHdlr {
val regUser = RegisteredUsers.create(msg.body.intUserId, msg.body.extUserId,
msg.body.name, msg.body.role, msg.body.authToken, msg.body.sessionToken,
msg.body.avatarURL, ColorPicker.nextColor(liveMeeting.props.meetingProp.intId), msg.body.guest, msg.body.authed, guestStatus, msg.body.excludeFromDashboard, msg.body.customParameters, false)
msg.body.avatarURL, ColorPicker.nextColor(liveMeeting.props.meetingProp.intId), msg.body.guest, msg.body.authed,
guestStatus, msg.body.excludeFromDashboard, msg.body.enforceLayout, msg.body.customParameters, false)
checkUserConcurrentAccesses(regUser)
RegisteredUsers.add(liveMeeting.registeredUsers, regUser, liveMeeting.props.meetingProp.intId)

View File

@ -34,7 +34,7 @@ trait UserJoinedVoiceConfEvtMsgHdlr extends SystemConfiguration {
def registerUserInRegisteredUsers() = {
val regUser = RegisteredUsers.create(msg.body.intId, msg.body.voiceUserId,
msg.body.callerIdName, Roles.VIEWER_ROLE, "", "", "", userColor,
true, true, GuestStatus.WAIT, true, Map(), false)
true, true, GuestStatus.WAIT, true, "", Map(), false)
RegisteredUsers.add(liveMeeting.registeredUsers, regUser, liveMeeting.props.meetingProp.intId)
}

View File

@ -24,13 +24,14 @@ case class UserDbModel(
guestStatus: String,
registeredOn: Long,
excludeFromDashboard: Boolean,
enforceLayout: Option[String],
)
class UserDbTableDef(tag: Tag) extends Table[UserDbModel](tag, None, "user") {
override def * = (
userId,extId,meetingId,name,role,avatar,color, sessionToken, authed,joined,joinErrorCode, joinErrorMessage, banned,loggedOut,guest,guestStatus,registeredOn,excludeFromDashboard) <> (UserDbModel.tupled, UserDbModel.unapply)
userId,extId,meetingId,name,role,avatar,color, sessionToken, authed,joined,joinErrorCode, joinErrorMessage, banned,loggedOut,guest,guestStatus,registeredOn,excludeFromDashboard, enforceLayout) <> (UserDbModel.tupled, UserDbModel.unapply)
val userId = column[String]("userId", O.PrimaryKey)
val extId = column[String]("extId")
val meetingId = column[String]("meetingId")
@ -49,6 +50,7 @@ class UserDbTableDef(tag: Tag) extends Table[UserDbModel](tag, None, "user") {
val guestStatus = column[String]("guestStatus")
val registeredOn = column[Long]("registeredOn")
val excludeFromDashboard = column[Boolean]("excludeFromDashboard")
val enforceLayout = column[Option[String]]("enforceLayout")
}
object UserDAO {
@ -73,7 +75,11 @@ object UserDAO {
guest = regUser.guest,
guestStatus = regUser.guestStatus,
registeredOn = regUser.registeredOn,
excludeFromDashboard = regUser.excludeFromDashboard
excludeFromDashboard = regUser.excludeFromDashboard,
enforceLayout = regUser.enforceLayout match {
case "" => None
case enforceLayout: String => Some(enforceLayout)
}
)
)
).onComplete {

View File

@ -7,7 +7,8 @@ import org.bigbluebutton.core.domain.BreakoutRoom2x
object RegisteredUsers {
def create(userId: String, extId: String, name: String, roles: String,
authToken: String, sessionToken: String, avatar: String, color: String, guest: Boolean, authenticated: Boolean,
guestStatus: String, excludeFromDashboard: Boolean, customParameters: Map[String, String], loggedOut: Boolean): RegisteredUser = {
guestStatus: String, excludeFromDashboard: Boolean, enforceLayout: String,
customParameters: Map[String, String], loggedOut: Boolean): RegisteredUser = {
new RegisteredUser(
userId,
extId,
@ -25,6 +26,7 @@ object RegisteredUsers {
0,
false,
false,
enforceLayout,
customParameters,
loggedOut,
)
@ -214,6 +216,7 @@ case class RegisteredUser(
lastAuthTokenValidatedOn: Long,
joined: Boolean,
banned: Boolean,
enforceLayout: String,
customParameters: Map[String,String],
loggedOut: Boolean,
lastBreakoutRoom: BreakoutRoom2x = null,

View File

@ -56,7 +56,7 @@ object FakeUserGenerator {
val color = "#ff6242"
val ru = RegisteredUsers.create(userId = id, extId, name, role,
authToken, sessionToken, avatarURL, color, guest, authed, guestStatus = GuestStatus.ALLOW, false, Map(), false)
authToken, sessionToken, avatarURL, color, guest, authed, guestStatus = GuestStatus.ALLOW, false, "", Map(), false)
RegisteredUsers.add(users, ru, meetingId)
ru
}

View File

@ -13,9 +13,10 @@ object TestDataGen {
val sessionToken = RandomStringGenerator.randomAlphanumericString(16)
val avatarURL = "https://www." + RandomStringGenerator.randomAlphanumericString(32) + ".com/" +
RandomStringGenerator.randomAlphanumericString(10) + ".png"
val color = "#ff6242"
val ru = RegisteredUsers.create(userId = id, extId, name, role,
authToken, sessionToken, avatarURL, guest, authed, GuestStatus.ALLOW, false)
authToken, sessionToken, avatarURL, color, guest, authed, GuestStatus.ALLOW, false, "", Map(), false)
RegisteredUsers.add(users, ru, meetingId = "test")
ru

View File

@ -8,7 +8,7 @@ case class RegisterUserReqMsg(
case class RegisterUserReqMsgBody(meetingId: String, intUserId: String, name: String, role: String,
extUserId: String, authToken: String, sessionToken: String, avatarURL: String,
guest: Boolean, authed: Boolean, guestStatus: String, excludeFromDashboard: Boolean,
customParameters: Map[String, String])
enforceLayout: String, customParameters: Map[String, String])
object UserRegisteredRespMsg { val NAME = "UserRegisteredRespMsg" }
case class UserRegisteredRespMsg(

View File

@ -122,13 +122,19 @@ public class MeetingService implements MessageListener {
public void registerUser(String meetingID, String internalUserId,
String fullname, String role, String externUserID,
String authToken, String sessionToken, String avatarURL, Boolean guest,
Boolean authed, String guestStatus, Boolean excludeFromDashboard, Boolean leftGuestLobby, Map<String, String> customParameters) {
handle(new RegisterUser(meetingID, internalUserId, fullname, role,
externUserID, authToken, sessionToken, avatarURL, guest, authed, guestStatus, excludeFromDashboard, leftGuestLobby, customParameters));
Boolean authed, String guestStatus, Boolean excludeFromDashboard, Boolean leftGuestLobby,
String enforceLayout, Map<String, String> customParameters) {
handle(
new RegisterUser(meetingID, internalUserId, fullname, role,
externUserID, authToken, sessionToken, avatarURL, guest, authed, guestStatus,
excludeFromDashboard, leftGuestLobby, enforceLayout, customParameters
)
);
Meeting m = getMeeting(meetingID);
if (m != null) {
RegisteredUser ruser = new RegisteredUser(authToken, internalUserId, guestStatus, excludeFromDashboard, leftGuestLobby);
RegisteredUser ruser = new RegisteredUser(authToken, internalUserId, guestStatus,
excludeFromDashboard, leftGuestLobby, enforceLayout);
m.userRegistered(ruser);
}
}
@ -423,7 +429,7 @@ public class MeetingService implements MessageListener {
gw.registerUser(message.meetingID,
message.internalUserId, message.fullname, message.role,
message.externUserID, message.authToken, message.sessionToken, message.avatarURL, message.guest,
message.authed, message.guestStatus, message.excludeFromDashboard, message.customParameters);
message.authed, message.guestStatus, message.excludeFromDashboard, message.enforceLayout, message.customParameters);
}
public Meeting getMeeting(String meetingId) {

View File

@ -9,13 +9,16 @@ public class RegisteredUser {
private Boolean excludeFromDashboard;
private Long guestWaitedOn;
private Boolean leftGuestLobby;
private String enforceLayout;
public RegisteredUser(String authToken, String userId, String guestStatus, Boolean excludeFromDashboard, Boolean leftGuestLobby) {
public RegisteredUser(String authToken, String userId, String guestStatus, Boolean excludeFromDashboard,
Boolean leftGuestLobby, String enforceLayout) {
this.authToken = authToken;
this.userId = userId;
this.guestStatus = guestStatus;
this.excludeFromDashboard = excludeFromDashboard;
this.leftGuestLobby = leftGuestLobby;
this.enforceLayout = enforceLayout;
Long currentTimeMillis = System.currentTimeMillis();
this.registeredOn = currentTimeMillis;
@ -30,6 +33,10 @@ public class RegisteredUser {
return guestStatus;
}
public void setLeftGuestLobby(boolean bool) {
this.leftGuestLobby = bool;
}
public Boolean getLeftGuestLobby() {
return leftGuestLobby;
}
@ -38,6 +45,14 @@ public class RegisteredUser {
this.excludeFromDashboard = excludeFromDashboard;
}
public String getEnforceLayout() {
return enforceLayout;
}
public void setEnforceLayout(String enforceLayout) {
this.enforceLayout = enforceLayout;
}
public Boolean getExcludeFromDashboard() {
return excludeFromDashboard;
}
@ -46,9 +61,6 @@ public class RegisteredUser {
this.guestWaitedOn = System.currentTimeMillis();
}
public void setLeftGuestLobby(boolean bool) {
this.leftGuestLobby = bool;
}
public Long getGuestWaitedOn() {
return this.guestWaitedOn;
}

View File

@ -41,6 +41,7 @@ public class UserSession {
public String welcome = null;
public String logoutUrl = null;
public String defaultLayout = "NOLAYOUT";
public String enforceLayout = "";
public String avatarURL;
public String guestStatus = GuestPolicy.ALLOW;
public String clientUrl = null;
@ -130,6 +131,10 @@ public class UserSession {
return defaultLayout;
}
public String getEnforceLayout() {
return enforceLayout;
}
public String getAvatarURL() {
return avatarURL;
}

View File

@ -18,12 +18,13 @@ public class RegisterUser implements IMessage {
public final String guestStatus;
public final Boolean excludeFromDashboard;
public final Boolean leftGuestLobby;
public final String enforceLayout;
public final Map<String, String> customParameters;
public RegisterUser(String meetingID, String internalUserId, String fullname, String role, String externUserID,
String authToken, String sessionToken, String avatarURL, Boolean guest,
Boolean authed, String guestStatus, Boolean excludeFromDashboard, Boolean leftGuestLobby,
Map<String, String> customParameters) {
String enforceLayout, Map<String, String> customParameters) {
this.meetingID = meetingID;
this.internalUserId = internalUserId;
this.fullname = fullname;
@ -37,6 +38,7 @@ public class RegisterUser implements IMessage {
this.guestStatus = guestStatus;
this.excludeFromDashboard = excludeFromDashboard;
this.leftGuestLobby = leftGuestLobby;
this.enforceLayout = enforceLayout;
this.customParameters = customParameters;
}
}

View File

@ -22,7 +22,8 @@ public interface IPublisherService {
void endMeeting(String meetingId);
void send(String channel, String message);
void registerUser(String meetingID, String internalUserId, String fullname, String role, String externUserID,
String authToken, String avatarURL, Boolean guest, Boolean excludeFromDashboard, Boolean authed);
String authToken, String avatarURL, Boolean guest, Boolean excludeFromDashboard,
String enforceLayout, Boolean authed);
void sendKeepAlive(String system, Long bbbWebTimestamp, Long akkaAppsTimestamp);
void sendStunTurnInfo(String meetingId, String internalUserId, Set<StunServer> stuns, Set<TurnEntry> turns);
}

View File

@ -52,7 +52,7 @@ public interface IBbbWebApiGWApp {
void registerUser(String meetingID, String internalUserId, String fullname, String role,
String externUserID, String authToken, String sessionToken, String avatarURL,
Boolean guest, Boolean authed, String guestStatus, Boolean excludeFromDashboard,
Map<String, String> customParameters);
String enforceLayout, Map<String, String> customParameters);
void guestWaitingLeft(String meetingID, String internalUserId);
void destroyMeeting(DestroyMeetingMessage msg);

View File

@ -262,7 +262,7 @@ class BbbWebApiGWApp(
role: String, extUserId: String, authToken: String, sessionToken: String,
avatarURL: String, guest: java.lang.Boolean, authed: java.lang.Boolean,
guestStatus: String, excludeFromDashboard: java.lang.Boolean,
customParameters: java.util.Map[String, String]): Unit = {
enforceLayout: String, customParameters: java.util.Map[String, String]): Unit = {
// meetingManagerActorRef ! new RegisterUser(meetingId = meetingId, intUserId = intUserId, name = name,
// role = role, extUserId = extUserId, authToken = authToken, avatarURL = avatarURL,
@ -271,7 +271,8 @@ class BbbWebApiGWApp(
val regUser = new RegisterUser(meetingId = meetingId, intUserId = intUserId, name = name,
role = role, extUserId = extUserId, authToken = authToken, sessionToken = sessionToken,
avatarURL = avatarURL, guest = guest.booleanValue(), authed = authed.booleanValue(),
guestStatus = guestStatus, excludeFromDashboard = excludeFromDashboard, customParameters = (customParameters).asScala.toMap)
guestStatus = guestStatus, excludeFromDashboard = excludeFromDashboard, enforceLayout = enforceLayout,
customParameters = (customParameters).asScala.toMap)
val event = MsgBuilder.buildRegisterUserRequestToAkkaApps(regUser)
msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, event))

View File

@ -50,7 +50,7 @@ object MsgBuilder {
val body = RegisterUserReqMsgBody(meetingId = msg.meetingId, intUserId = msg.intUserId,
name = msg.name, role = msg.role, extUserId = msg.extUserId, authToken = msg.authToken, sessionToken = msg.sessionToken,
avatarURL = msg.avatarURL, guest = msg.guest, authed = msg.authed, guestStatus = msg.guestStatus,
excludeFromDashboard = msg.excludeFromDashboard, customParameters = msg.customParameters)
excludeFromDashboard = msg.excludeFromDashboard, enforceLayout = msg.enforceLayout, customParameters = msg.customParameters)
val req = RegisterUserReqMsg(header, body)
BbbCommonEnvCoreMsg(envelope, req)
}

View File

@ -18,7 +18,7 @@ case class AddUserSession(token: String, session: UserSession)
case class RegisterUser(meetingId: String, intUserId: String, name: String, role: String,
extUserId: String, authToken: String, sessionToken: String, avatarURL: String,
guest: Boolean, authed: Boolean, guestStatus: String, excludeFromDashboard: Boolean,
customParameters: Map[String, String])
enforceLayout: String, customParameters: Map[String, String])
case class CreateMeetingMsg(defaultProps: DefaultProps)

View File

@ -29,7 +29,8 @@ trait ToAkkaAppsSendersTrait extends SystemConfiguration {
val body = RegisterUserReqMsgBody(meetingId = msg.meetingId, intUserId = msg.intUserId,
name = msg.name, role = msg.role, extUserId = msg.extUserId, authToken = msg.authToken,
sessionToken = msg.sessionToken, avatarURL = msg.avatarURL, guest = msg.guest, authed = msg.authed,
guestStatus = msg.guestStatus, excludeFromDashboard = msg.excludeFromDashboard, customParameters = msg.customParameters)
guestStatus = msg.guestStatus, excludeFromDashboard = msg.excludeFromDashboard,
enforceLayout = msg.enforceLayout, customParameters = msg.customParameters)
val req = RegisterUserReqMsg(header, body)
val message = BbbCommonEnvCoreMsg(envelope, req)
sendToBus(message)

View File

@ -1,12 +0,0 @@
package org.bigbluebutton.api2.meeting
case class UserSession2(authToken: String, internalUserId: String, conferencename: String,
meetingID: String, externMeetingID: String, externUserID: String, fullname: String,
role: String, conference: String, room: String, guest: Boolean = false,
authed: Boolean = false, voicebridge: String, webvoiceconf: String,
mode: String, record: String, welcome: String, logoutUrl: String,
defaultLayout: String = "NOLAYOUT", avatarURL: String)
class UserSessions {
}

View File

@ -238,6 +238,7 @@ CREATE TABLE "user" (
"guestStatus" varchar(50),
"registeredOn" bigint,
"excludeFromDashboard" bool,
"enforceLayout" varchar(50),
--columns of user state bellow
"raiseHand" bool default false,
"raiseHandTime" timestamp with time zone,
@ -390,6 +391,7 @@ AS SELECT "user"."userId",
-- "user"."guestStatus",
"user"."mobile",
"user"."clientType",
"user"."enforceLayout",
"user"."isDialIn",
"user"."role",
"user"."authed",

View File

@ -135,6 +135,7 @@ select_permissions:
- away
- banned
- clientType
- enforceLayout
- color
- disconnected
- echoTestRunningAt

View File

@ -1,8 +1,8 @@
- "!include public_v_caption.yaml"
- "!include public_v_breakoutRoom.yaml"
- "!include public_v_breakoutRoom_assignedUser.yaml"
- "!include public_v_breakoutRoom_participant.yaml"
- "!include public_v_breakoutRoom_user.yaml"
- "!include public_v_caption.yaml"
- "!include public_v_chat.yaml"
- "!include public_v_chat_message_private.yaml"
- "!include public_v_chat_message_public.yaml"

View File

@ -417,6 +417,10 @@ class ApiController {
us.defaultLayout = params.defaultLayout;
}
if (!StringUtils.isEmpty(params.enforceLayout)) {
us.enforceLayout = params.enforceLayout;
}
if (!StringUtils.isEmpty(params.avatarURL)) {
us.avatarURL = params.avatarURL;
} else {
@ -459,6 +463,7 @@ class ApiController {
guestStatusVal,
us.excludeFromDashboard,
us.leftGuestLobby,
us.enforceLayout,
meeting.getUserCustomData(us.externUserID)
)