refactor: Rename all customParameters references to userMetadata or userdata (#20692)

* Rename all customParameters references to userMetadata

* fix linter error

* Update docs/docs/development/api.md

Co-authored-by: Anton Georgiev <antobinary@users.noreply.github.com>

* Update bigbluebutton-html5/imports/ui/components/settings-loader/component.tsx

---------

Co-authored-by: Anton Georgiev <antobinary@users.noreply.github.com>
This commit is contained in:
Gustavo Trott 2024-07-16 14:40:49 -03:00 committed by GitHub
parent 81d5d7daae
commit 1683f4c3fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
30 changed files with 118 additions and 118 deletions

View File

@ -63,7 +63,7 @@ trait RegisterUserReqMsgHdlr {
val regUser = RegisteredUsers.create(liveMeeting.props.meetingProp.intId, 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.enforceLayout, msg.body.customParameters, false)
guestStatus, msg.body.excludeFromDashboard, msg.body.enforceLayout, msg.body.userMetadata, false)
checkUserConcurrentAccesses(regUser)
RegisteredUsers.add(liveMeeting.registeredUsers, regUser, liveMeeting.props.meetingProp.intId)

View File

@ -1,39 +0,0 @@
package org.bigbluebutton.core.db
import slick.jdbc.PostgresProfile.api._
import slick.lifted.{ ProvenShape }
case class UserCustomParameterDbModel(
meetingId: String,
userId: String,
parameter: String,
value: String
)
class UserCustomParameterDbTableDef(tag: Tag) extends Table[UserCustomParameterDbModel](tag, "user_customParameter") {
val meetingId = column[String]("meetingId", O.PrimaryKey)
val userId = column[String]("userId", O.PrimaryKey)
val parameter = column[String]("parameter", O.PrimaryKey)
val value = column[String]("value")
override def * : ProvenShape[UserCustomParameterDbModel] = (meetingId, userId, parameter, value) <> (UserCustomParameterDbModel.tupled, UserCustomParameterDbModel.unapply)
}
object UserCustomParameterDAO {
def insert(meetingId: String, userId: String, customParameters: Map[String, String]) = {
DatabaseConnection.enqueue(DBIO.sequence(
for {
parameter <- customParameters
} yield {
TableQuery[UserCustomParameterDbTableDef].insertOrUpdate(
UserCustomParameterDbModel(
meetingId = meetingId,
userId = userId,
parameter = parameter._1,
value = parameter._2
)
)
}
).transactionally)
}
}

View File

@ -86,7 +86,7 @@ object UserDAO {
)
UserConnectionStatusDAO.insert(meetingId, regUser.id)
UserCustomParameterDAO.insert(meetingId, regUser.id, regUser.customParameters)
UserMetadataDAO.insert(meetingId, regUser.id, regUser.userMetadata)
UserClientSettingsDAO.insertOrUpdate(meetingId, regUser.id, JsonUtils.stringToJson("{}"))
ChatUserDAO.insertUserPublicChat(meetingId, regUser.id)
}

View File

@ -0,0 +1,39 @@
package org.bigbluebutton.core.db
import slick.jdbc.PostgresProfile.api._
import slick.lifted.{ ProvenShape }
case class UserMetadataDbModel(
meetingId: String,
userId: String,
parameter: String,
value: String
)
class UserMetadataDbTableDef(tag: Tag) extends Table[UserMetadataDbModel](tag, "user_metadata") {
val meetingId = column[String]("meetingId", O.PrimaryKey)
val userId = column[String]("userId", O.PrimaryKey)
val parameter = column[String]("parameter", O.PrimaryKey)
val value = column[String]("value")
override def * : ProvenShape[UserMetadataDbModel] = (meetingId, userId, parameter, value) <> (UserMetadataDbModel.tupled, UserMetadataDbModel.unapply)
}
object UserMetadataDAO {
def insert(meetingId: String, userId: String, userMetadata: Map[String, String]) = {
DatabaseConnection.enqueue(DBIO.sequence(
for {
metadata <- userMetadata
} yield {
TableQuery[UserMetadataDbTableDef].insertOrUpdate(
UserMetadataDbModel(
meetingId = meetingId,
userId = userId,
parameter = metadata._1,
value = metadata._2
)
)
}
).transactionally)
}
}

View File

@ -8,7 +8,7 @@ object RegisteredUsers {
def create(meetingId: String, userId: String, extId: String, name: String, roles: String,
authToken: String, sessionToken: String, avatar: String, color: String, guest: Boolean, authenticated: Boolean,
guestStatus: String, excludeFromDashboard: Boolean, enforceLayout: String,
customParameters: Map[String, String], loggedOut: Boolean): RegisteredUser = {
userMetadata: Map[String, String], loggedOut: Boolean): RegisteredUser = {
new RegisteredUser(
userId,
extId,
@ -31,7 +31,7 @@ object RegisteredUsers {
ejected = false,
banned = false,
enforceLayout,
customParameters,
userMetadata,
loggedOut,
)
}
@ -252,7 +252,7 @@ case class RegisteredUser(
ejected: Boolean,
banned: Boolean,
enforceLayout: String,
customParameters: Map[String,String],
userMetadata: Map[String,String],
loggedOut: Boolean,
lastBreakoutRoom: BreakoutRoom2x = null,
)

View File

@ -451,7 +451,7 @@ case class UserState(
userLeftFlag: UserLeftFlag,
speechLocale: String = "",
captionLocale: String = "",
customParameters: Map[String, String] = Map.empty
userMetadata: Map[String, String] = Map.empty
)

View File

@ -47,8 +47,8 @@ class ParticipantJoinRecordEvent extends AbstractParticipantRecordEvent {
eventMap.put(ROLE, role)
}
def setUserdata(customParameters: Map[String, String]): Unit = {
eventMap.put(USER_DATA, customParameters.toJson.compactPrint)
def setUserdata(userMetadata: Map[String, String]): Unit = {
eventMap.put(USER_DATA, userMetadata.toJson.compactPrint)
}
}

View File

@ -75,7 +75,7 @@ trait HandlerHelpers extends SystemConfiguration {
color = regUser.color,
clientType = clientType,
userLeftFlag = UserLeftFlag(false, 0),
customParameters = regUser.customParameters
userMetadata = regUser.userMetadata
)
}

View File

@ -18,7 +18,7 @@ object UserJoinedMeetingEvtMsgBuilder {
pin = userState.pin,
presenter = userState.presenter, locked = userState.locked, avatar = userState.avatar, color = userState.color,
clientType = userState.clientType,
customParameters = userState.customParameters)
userMetadata = userState.userMetadata)
val event = UserJoinedMeetingEvtMsg(meetingId, userState.intId, body)

View File

@ -352,7 +352,7 @@ class RedisRecorderActor(
ev.setExternalUserId(msg.body.extId)
ev.setName(msg.body.name)
ev.setRole(msg.body.role)
ev.setUserdata(msg.body.customParameters)
ev.setUserdata(msg.body.userMetadata)
record(msg.header.meetingId, ev.toMap.asJava)
}

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,
enforceLayout: String, customParameters: Map[String, String])
enforceLayout: String, userMetadata: Map[String, String])
object UserRegisteredRespMsg { val NAME = "UserRegisteredRespMsg" }
case class UserRegisteredRespMsg(
@ -90,24 +90,24 @@ case class UserJoinedMeetingEvtMsg(
body: UserJoinedMeetingEvtMsgBody
) extends BbbCoreMsg
case class UserJoinedMeetingEvtMsgBody(
intId: String,
extId: String,
name: String,
role: String,
guest: Boolean,
authed: Boolean,
guestStatus: String,
emoji: String,
reactionEmoji: String,
raiseHand: Boolean,
away: Boolean,
pin: Boolean,
presenter: Boolean,
locked: Boolean,
avatar: String,
color: String,
clientType: String,
customParameters: Map[String, String]
intId: String,
extId: String,
name: String,
role: String,
guest: Boolean,
authed: Boolean,
guestStatus: String,
emoji: String,
reactionEmoji: String,
raiseHand: Boolean,
away: Boolean,
pin: Boolean,
presenter: Boolean,
locked: Boolean,
avatar: String,
color: String,
clientType: String,
userMetadata: Map[String, String]
)
/**

View File

@ -124,11 +124,11 @@ public class MeetingService implements MessageListener {
String fullname, String role, String externUserID,
String authToken, String sessionToken, String avatarURL, Boolean guest,
Boolean authed, String guestStatus, Boolean excludeFromDashboard, Boolean leftGuestLobby,
String enforceLayout, Map<String, String> customParameters) {
String enforceLayout, Map<String, String> userMetadata) {
handle(
new RegisterUser(meetingID, internalUserId, fullname, role,
externUserID, authToken, sessionToken, avatarURL, guest, authed, guestStatus,
excludeFromDashboard, leftGuestLobby, enforceLayout, customParameters
excludeFromDashboard, leftGuestLobby, enforceLayout, userMetadata
)
);
@ -447,7 +447,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.enforceLayout, message.customParameters);
message.authed, message.guestStatus, message.excludeFromDashboard, message.enforceLayout, message.userMetadata);
}
public Meeting getMeeting(String meetingId) {

View File

@ -19,12 +19,12 @@ public class RegisterUser implements IMessage {
public final Boolean excludeFromDashboard;
public final Boolean leftGuestLobby;
public final String enforceLayout;
public final Map<String, String> customParameters;
public final Map<String, String> userMetadata;
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,
String enforceLayout, Map<String, String> customParameters) {
String enforceLayout, Map<String, String> userMetadata) {
this.meetingID = meetingID;
this.internalUserId = internalUserId;
this.fullname = fullname;
@ -39,6 +39,6 @@ public class RegisterUser implements IMessage {
this.excludeFromDashboard = excludeFromDashboard;
this.leftGuestLobby = leftGuestLobby;
this.enforceLayout = enforceLayout;
this.customParameters = customParameters;
this.userMetadata = userMetadata;
}
}

View File

@ -73,7 +73,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,
String enforceLayout, Map<String, String> customParameters);
String enforceLayout, Map<String, String> userMetadata);
void destroyMeeting(DestroyMeetingMessage msg);
void endMeeting(EndMeetingMessage msg);

View File

@ -286,7 +286,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,
enforceLayout: String, customParameters: java.util.Map[String, String]): Unit = {
enforceLayout: String, userMetadata: java.util.Map[String, String]): Unit = {
// meetingManagerActorRef ! new RegisterUser(meetingId = meetingId, intUserId = intUserId, name = name,
// role = role, extUserId = extUserId, authToken = authToken, avatarURL = avatarURL,
@ -296,7 +296,7 @@ class BbbWebApiGWApp(
role = role, extUserId = extUserId, authToken = authToken, sessionToken = sessionToken,
avatarURL = avatarURL, guest = guest.booleanValue(), authed = authed.booleanValue(),
guestStatus = guestStatus, excludeFromDashboard = excludeFromDashboard, enforceLayout = enforceLayout,
customParameters = (customParameters).asScala.toMap)
userMetadata = (userMetadata).asScala.toMap)
val event = MsgBuilder.buildRegisterUserRequestToAkkaApps(regUser)
msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, event))

View File

@ -51,7 +51,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, enforceLayout = msg.enforceLayout, customParameters = msg.customParameters)
excludeFromDashboard = msg.excludeFromDashboard, enforceLayout = msg.enforceLayout, userMetadata = msg.userMetadata)
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,
enforceLayout: String, customParameters: Map[String, String])
enforceLayout: String, userMetadata: Map[String, String])
case class CreateMeetingMsg(defaultProps: DefaultProps)

View File

@ -30,7 +30,7 @@ trait ToAkkaAppsSendersTrait extends SystemConfiguration {
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,
enforceLayout = msg.enforceLayout, customParameters = msg.customParameters)
enforceLayout = msg.enforceLayout, userMetadata = msg.userMetadata)
val req = RegisterUserReqMsg(header, body)
val message = BbbCommonEnvCoreMsg(envelope, req)
sendToBus(message)

View File

@ -551,19 +551,19 @@ AS SELECT
"user"."isOnline"
FROM "user";
create table "user_customParameter"(
create table "user_metadata"(
"meetingId" varchar(100),
"userId" varchar(50),
"parameter" varchar(255),
"value" varchar(255),
CONSTRAINT "user_customParameter_pkey" PRIMARY KEY ("meetingId", "userId","parameter"),
CONSTRAINT "user_metadata_pkey" PRIMARY KEY ("meetingId", "userId","parameter"),
FOREIGN KEY ("meetingId", "userId") REFERENCES "user"("meetingId","userId") ON DELETE CASCADE
);
create index "idx_user_customParameter_pk_reverse" on "user_customParameter" ("userId", "meetingId");
create index "idx_user_metadata_pk_reverse" on "user_metadata" ("userId", "meetingId");
CREATE VIEW "v_user_customParameter" AS
CREATE VIEW "v_user_metadata" AS
SELECT *
FROM "user_customParameter";
FROM "user_metadata";
CREATE VIEW "v_user_welcomeMsgs" AS
SELECT

View File

@ -16,14 +16,14 @@ object_relationships:
remote_table:
name: v_user_connectionStatus
schema: public
- name: customParameters
- name: userMetadata
using:
manual_configuration:
column_mapping:
userId: userId
insertion_order: null
remote_table:
name: v_user_customParameter
name: v_user_metadata
schema: public
- name: guestStatusDetails
using:

View File

@ -1,10 +1,10 @@
table:
name: v_user_customParameter
name: v_user_metadata
schema: public
configuration:
column_config: {}
custom_column_names: {}
custom_name: user_customParameter
custom_name: user_metadata
custom_root_fields: {}
select_permissions:
- role: bbb_client

View File

@ -51,7 +51,7 @@
- "!include public_v_user_connectionStatus.yaml"
- "!include public_v_user_connectionStatusReport.yaml"
- "!include public_v_user_current.yaml"
- "!include public_v_user_customParameter.yaml"
- "!include public_v_user_metadata.yaml"
- "!include public_v_user_guest.yaml"
- "!include public_v_user_reaction.yaml"
- "!include public_v_user_ref.yaml"

View File

@ -39,7 +39,7 @@ export interface Voice {
startTime: number;
}
export interface CustomParameter {
export interface UserMetadata {
parameter: string;
value: string;
}

View File

@ -1,6 +1,6 @@
import { useQuery } from '@apollo/client';
import React, { useEffect } from 'react';
import { UserCustomParameterResponse, getCustomParameter } from './queries';
import { UserMetadataResponse, getUserMetadata } from './queries';
import { setUserSettings } from '/imports/ui/core/local-states/useUserSettings';
interface CustomUsersSettingsProps {
@ -11,14 +11,14 @@ const CustomUsersSettings: React.FC<CustomUsersSettingsProps> = ({
children,
}) => {
const {
data: customParameterData,
loading: customParameterLoading,
error: customParameterError,
} = useQuery<UserCustomParameterResponse>(getCustomParameter);
data: userMetadataData,
loading: userMetadataLoading,
error: userMetadataError,
} = useQuery<UserMetadataResponse>(getUserMetadata);
const [allowToRender, setAllowToRender] = React.useState(false);
useEffect(() => {
if (customParameterData && !customParameterLoading) {
const filteredData = customParameterData.user_customParameter.map((uc) => {
if (userMetadataData && !userMetadataLoading) {
const filteredData = userMetadataData.user_metadata.map((uc) => {
const { parameter, value } = uc;
let parsedValue: string | boolean | string[] = '';
try {
@ -32,15 +32,15 @@ const CustomUsersSettings: React.FC<CustomUsersSettingsProps> = ({
setAllowToRender(true);
}
}, [
customParameterData,
customParameterLoading,
userMetadataData,
userMetadataLoading,
]);
useEffect(() => {
if (customParameterError) {
throw new Error(`Error on requesting custom parameter data: ${customParameterError}`);
if (userMetadataError) {
throw new Error(`Error on requesting custom parameter data: ${userMetadataError}`);
}
}, [customParameterError]);
}, [userMetadataError]);
return allowToRender ? <>{children}</> : null;
};

View File

@ -1,17 +1,17 @@
import { gql } from '@apollo/client';
interface CustomParameter {
interface UserMetadata {
parameter: string;
value: string;
}
export interface UserCustomParameterResponse {
user_customParameter: CustomParameter[];
export interface UserMetadataResponse {
user_metadata: UserMetadata[];
}
export const getCustomParameter = gql`
query getCustomParameter {
user_customParameter {
export const getUserMetadata = gql`
query getUserMetadata {
user_metadata {
parameter
value
}
@ -19,5 +19,5 @@ export const getCustomParameter = gql`
`;
export default {
getCustomParameter,
getUserMetadata,
};

View File

@ -2,7 +2,7 @@ import DEFAULT_VALUES from '/imports/ui/components/layout/defaultValues';
export const INITIAL_INPUT_STATE = {
autoarrAngeLayout: true,
customParameters: {
userMetadata: {
},
browser: {

View File

@ -246,7 +246,7 @@ interface Input {
bannerBar: BannerBar;
browser: Browser;
cameraDock: CameraDock
customParameters: NonNullable<unknown>;
userMetadata: NonNullable<unknown>;
externalVideo: ExternalVideo;
genericMainContent: GenericContentMainArea;
navBar: NavBar;

View File

@ -1375,14 +1375,14 @@ These configs can be set in `/etc/bigbluebutton/bbb-web.properties`
- _`overwritable`_: Config will be overwritten if the param is present in the API `/create` request
### Passing custom parameters to the client on join
### Passing user metadata to the client on join
The HTML5 client supports a list of parameters that can be added to the `join` API call which modify the look and default behaviour of the client. This list is accurate as of BigBlueButton version 2.2.17 (build 937). These parameters override the global defaults set in `settings.yml`. As the parameters are passed on call to join, it allows for some powerful customization that can vary depending on which user is joining the session.
Useful tools for development:
- A tool like (https://meyerweb.com/eric/tools/dencoder/) is useful in the encoding-decoding process for the fields expecting encoded value passed (see below).
- The [API mate](https://mconf.github.io/api-mate/) allows you to directly experiment with these custom parameters. To use the API mate, run the following command on your BigBlueButton machine: `sudo bbb-conf --secret`. This creates a link for you with your secret as a parameter so you can get started experimenting right away.
- The [API mate](https://mconf.github.io/api-mate/) allows you to directly experiment with these user metadata. To use the API mate, run the following command on your BigBlueButton machine: `sudo bbb-conf --secret`. This creates a link for you with your secret as a parameter so you can get started experimenting right away.
#### Application parameters

View File

@ -550,7 +550,7 @@ There is a XML response for this call only when the `redirect` parameter is set
</response>
```
See [Passing custom parameters to the client on join](/administration/customize/#passing-custom-parameters-to-the-client-on-join) for additional `join` parameters that can override default settings for the user.
See [Passing user metadata to the client on join](/administration/customize/#passing-user-metadata-to-the-client-on-join) for additional `join` parameters that can override default settings for the user.
### `POST` insertDocument
@ -1264,7 +1264,7 @@ See the following [bigbluebutton-api-ruby](https://github.com/mconf/bigbluebutto
To help you create/test valid API calls against your BigBlueButton server, use the excellent [API Mate](http://mconf.github.io/api-mate/) to interactively create API calls. API Mate generates the checksums within the browser (no server component needed) so you can use it to test API calls against a local BigBlueButton server.
If you're developing new API calls or adding parameters on API calls, you can still use the API Mate to test them. Just scroll the page down or type "custom" in the parameter filter and you'll see the inputs where you can add custom API calls or custom parameters. New API calls will appear in the list of API links and new parameters will be added to all the API links.
If you're developing new API calls or adding parameters on API calls, you can still use the API Mate to test them. Just scroll the page down or type "custom" in the parameter filter and you'll see the inputs where you can add custom API calls or user metadata. New API calls will appear in the list of API links and new parameters will be added to all the API links.
If your using API Mate to test recordings and want to query by `meetingID`, be sure to clear the `recordID` field first. BigBlueButton's API supports querying for recordings by either value, but not both at the same time.

View File

@ -1717,7 +1717,7 @@ Note :
## Custom Parameters [(Automated)](https://github.com/bigbluebutton/bigbluebutton/blob/v2.6.x-release/bigbluebutton-tests/playwright/customparameters/customparameters.spec.js)
Client should apply custom parameters according to the descriptions from [here](/administration/customize#application-parameters).
Client should apply user metadata according to the descriptions from [here](/administration/customize#application-parameters).
## iFrame