- add authorized role to registered user

This commit is contained in:
Richard Alam 2017-04-17 21:23:17 +00:00
parent 262c7250c8
commit b8de0c9231
24 changed files with 112 additions and 162 deletions

View File

@ -60,7 +60,7 @@ libraryDependencies ++= {
"com.google.code.gson" % "gson" % "2.5", "com.google.code.gson" % "gson" % "2.5",
"redis.clients" % "jedis" % "2.7.2", "redis.clients" % "jedis" % "2.7.2",
"org.apache.commons" % "commons-lang3" % "3.2", "org.apache.commons" % "commons-lang3" % "3.2",
"org.bigbluebutton" % "bbb-common-message" % "0.0.18-SNAPSHOT", "org.bigbluebutton" % "bbb-common-message" % "0.0.19-SNAPSHOT",
"io.spray" %% "spray-json" % "1.3.2" "io.spray" %% "spray-json" % "1.3.2"
) )
} }

View File

@ -32,7 +32,8 @@ public interface IBigBlueButtonInGW {
// Users // Users
void validateAuthToken(String meetingId, String userId, String token, String correlationId, String sessionId); void validateAuthToken(String meetingId, String userId, String token, String correlationId, String sessionId);
void registerUser(String roomName, String userid, String username, String role, String externUserID, String authToken, String avatarURL, Boolean guest); void registerUser(String roomName, String userid, String username, String role, String externUserID,
String authToken, String avatarURL, Boolean guest, Boolean authed);
void userEmojiStatus(String meetingId, String userId, String emojiStatus); void userEmojiStatus(String meetingId, String userId, String emojiStatus);
void shareWebcam(String meetingId, String userId, String stream); void shareWebcam(String meetingId, String userId, String stream);
void unshareWebcam(String meetingId, String userId, String stream); void unshareWebcam(String meetingId, String userId, String stream);

View File

@ -12,12 +12,13 @@ import org.bigbluebutton.common.messages.KeepAliveMessage;
import org.bigbluebutton.common.messages.MessageFromJsonConverter; import org.bigbluebutton.common.messages.MessageFromJsonConverter;
import org.bigbluebutton.common.messages.MessagingConstants; import org.bigbluebutton.common.messages.MessagingConstants;
import org.bigbluebutton.common.messages.PubSubPingMessage; import org.bigbluebutton.common.messages.PubSubPingMessage;
import org.bigbluebutton.common.messages.RegisterUserMessage;
import org.bigbluebutton.common.messages.UserConnectedToGlobalAudio; import org.bigbluebutton.common.messages.UserConnectedToGlobalAudio;
import org.bigbluebutton.common.messages.UserDisconnectedFromGlobalAudio; import org.bigbluebutton.common.messages.UserDisconnectedFromGlobalAudio;
import org.bigbluebutton.common.messages.ValidateAuthTokenMessage; import org.bigbluebutton.common.messages.ValidateAuthTokenMessage;
import org.bigbluebutton.core.api.IBigBlueButtonInGW; import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import org.bigbluebutton.messages.CreateMeetingRequest; import org.bigbluebutton.messages.CreateMeetingRequest;
import org.bigbluebutton.messages.RegisterUserMessage;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -46,9 +47,13 @@ public class MeetingMessageReceiver implements MessageHandler {
String messageName = header.get("name").getAsString(); String messageName = header.get("name").getAsString();
if (CreateMeetingRequest.NAME.equals(messageName)) { if (CreateMeetingRequest.NAME.equals(messageName)) {
Gson gson = new Gson(); Gson gson = new Gson();
CreateMeetingRequest msg = gson.fromJson(message, CreateMeetingRequest msg = gson.fromJson(message, CreateMeetingRequest.class);
CreateMeetingRequest.class);
bbbGW.handleBigBlueButtonMessage(msg); bbbGW.handleBigBlueButtonMessage(msg);
} else if (RegisterUserMessage.NAME.equals(messageName)) {
Gson gson = new Gson();
RegisterUserMessage msg = gson.fromJson(message, RegisterUserMessage.class);
bbbGW.registerUser(msg.payload.meetingId, msg.payload.userId, msg.payload.name, msg.payload.role,
msg.payload.extUserId, msg.payload.authToken, msg.payload.avatarUrl, msg.payload.guest);
} }
} }
} }
@ -59,9 +64,6 @@ public class MeetingMessageReceiver implements MessageHandler {
if (msg instanceof EndMeetingMessage) { if (msg instanceof EndMeetingMessage) {
EndMeetingMessage emm = (EndMeetingMessage) msg; EndMeetingMessage emm = (EndMeetingMessage) msg;
bbbGW.endMeeting(emm.meetingId); bbbGW.endMeeting(emm.meetingId);
} else if (msg instanceof RegisterUserMessage) {
RegisterUserMessage rum = (RegisterUserMessage) msg;
bbbGW.registerUser(rum.meetingID, rum.internalUserId, rum.fullname, rum.role, rum.externUserID, rum.authToken, rum.avatarURL, rum.guest);
} else if (msg instanceof DestroyMeetingMessage) { } else if (msg instanceof DestroyMeetingMessage) {
DestroyMeetingMessage dmm = (DestroyMeetingMessage) msg; DestroyMeetingMessage dmm = (DestroyMeetingMessage) msg;
bbbGW.destroyMeeting(dmm.meetingId); bbbGW.destroyMeeting(dmm.meetingId);

View File

@ -145,9 +145,11 @@ class BigBlueButtonInGW(
eventBus.publish(BigBlueButtonEvent(meetingId, new ValidateAuthToken(meetingId, userId, token, correlationId, sessionId))) eventBus.publish(BigBlueButtonEvent(meetingId, new ValidateAuthToken(meetingId, userId, token, correlationId, sessionId)))
} }
def registerUser(meetingID: String, userID: String, name: String, role: String, extUserID: String, authToken: String, avatarURL: String, guest: java.lang.Boolean): Unit = { def registerUser(meetingID: String, userID: String, name: String, role: String, extUserID: String,
authToken: String, avatarURL: String, guest: java.lang.Boolean, authed: java.lang.Boolean): Unit = {
val userRole = if (role == "MODERATOR") Role.MODERATOR else Role.VIEWER val userRole = if (role == "MODERATOR") Role.MODERATOR else Role.VIEWER
eventBus.publish(BigBlueButtonEvent(meetingID, new RegisterUser(meetingID, userID, name, userRole, extUserID, authToken, avatarURL, guest))) eventBus.publish(BigBlueButtonEvent(meetingID, new RegisterUser(meetingID, userID, name, userRole,
extUserID, authToken, avatarURL, guest, authed)))
} }
def sendLockSettings(meetingID: String, userId: String, settings: java.util.Map[String, java.lang.Boolean]) { def sendLockSettings(meetingID: String, userId: String, settings: java.util.Map[String, java.lang.Boolean]) {

View File

@ -77,7 +77,7 @@ case class GetLockSettings(meetingID: String, userId: String) extends InMessage
case class ValidateAuthToken(meetingID: String, userId: String, token: String, case class ValidateAuthToken(meetingID: String, userId: String, token: String,
correlationId: String, sessionId: String) extends InMessage correlationId: String, sessionId: String) extends InMessage
case class RegisterUser(meetingID: String, userID: String, name: String, role: Role, case class RegisterUser(meetingID: String, userID: String, name: String, role: Role,
extUserID: String, authToken: String, avatarURL: String, guest: Boolean) extends InMessage extUserID: String, authToken: String, avatarURL: String, guest: Boolean, authed: Boolean) extends InMessage
case class UserJoining(meetingID: String, userID: String, authToken: String) extends InMessage case class UserJoining(meetingID: String, userID: String, authToken: String) extends InMessage
case class UserLeaving(meetingID: String, userID: String, sessionId: String) extends InMessage case class UserLeaving(meetingID: String, userID: String, sessionId: String) extends InMessage
case class GetUsers(meetingID: String, requesterID: String) extends InMessage case class GetUsers(meetingID: String, requesterID: String) extends InMessage

View File

@ -95,6 +95,7 @@ case class RegisteredUser(
authToken: String, authToken: String,
avatarURL: String, avatarURL: String,
guest: Boolean, guest: Boolean,
authed: Boolean,
waitingForAcceptance: Boolean) waitingForAcceptance: Boolean)
case class Voice( case class Voice(

View File

@ -121,7 +121,8 @@ trait UsersApp {
log.info("Register user failed. Mmeeting has ended. meetingId=" + mProps.meetingID + " userId=" + msg.userID) log.info("Register user failed. Mmeeting has ended. meetingId=" + mProps.meetingID + " userId=" + msg.userID)
sendMeetingHasEnded(msg.userID) sendMeetingHasEnded(msg.userID)
} else { } else {
val regUser = new RegisteredUser(msg.userID, msg.extUserID, msg.name, msg.role, msg.authToken, msg.avatarURL, msg.guest, msg.guest) val regUser = new RegisteredUser(msg.userID, msg.extUserID, msg.name, msg.role, msg.authToken, msg.avatarURL,
msg.guest, msg.authed, msg.guest)
usersModel.addRegisteredUser(msg.authToken, regUser) usersModel.addRegisteredUser(msg.authToken, regUser)
log.info("Register user success. meetingId=" + mProps.meetingID + " userId=" + msg.userID + " user=" + regUser) log.info("Register user success. meetingId=" + mProps.meetingID + " userId=" + msg.userID + " user=" + regUser)

View File

@ -52,7 +52,7 @@ libraryDependencies ++= {
"com.google.code.gson" % "gson" % "1.7.1", "com.google.code.gson" % "gson" % "1.7.1",
"redis.clients" % "jedis" % "2.1.0", "redis.clients" % "jedis" % "2.1.0",
"org.apache.commons" % "commons-lang3" % "3.2", "org.apache.commons" % "commons-lang3" % "3.2",
"org.bigbluebutton" % "bbb-common-message" % "0.0.18-SNAPSHOT", "org.bigbluebutton" % "bbb-common-message" % "0.0.19-SNAPSHOT",
"org.bigbluebutton" % "bbb-fsesl-client" % "0.0.4" "org.bigbluebutton" % "bbb-fsesl-client" % "0.0.4"
)} )}

View File

@ -2,7 +2,7 @@ name := "bbb-common-message"
organization := "org.bigbluebutton" organization := "org.bigbluebutton"
version := "0.0.18-SNAPSHOT" version := "0.0.19-SNAPSHOT"
// We want to have our jar files in lib_managed dir. // We want to have our jar files in lib_managed dir.
// This way we'll have the right path when we import // This way we'll have the right path when we import

View File

@ -3,6 +3,7 @@ package org.bigbluebutton.common.messages;
import java.util.Map; import java.util.Map;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import org.bigbluebutton.messages.RegisterUserMessage;
public class MessageFromJsonConverter { public class MessageFromJsonConverter {
@ -27,8 +28,6 @@ public class MessageFromJsonConverter {
return processKeepAlive(payload); return processKeepAlive(payload);
case ActivityResponseMessage.ACTIVITY_RESPONSE: case ActivityResponseMessage.ACTIVITY_RESPONSE:
return processActivityResponseMessage(payload); return processActivityResponseMessage(payload);
case RegisterUserMessage.REGISTER_USER:
return RegisterUserMessage.fromJson(message);
case ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN: case ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN:
return processValidateAuthTokenMessage(header, payload); return processValidateAuthTokenMessage(header, payload);
// return ValidateAuthTokenMessage.fromJson(message); // return ValidateAuthTokenMessage.fromJson(message);

View File

@ -1,83 +0,0 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class RegisterUserMessage implements IBigBlueButtonMessage {
public static final String REGISTER_USER = "register_user_request";
public final String VERSION = "0.0.1";
public final String meetingID;
public final String internalUserId;
public final String fullname;
public final String role;
public final String externUserID;
public final String authToken;
public final String avatarURL;
public final Boolean guest;
public RegisterUserMessage(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken, String avatarURL, Boolean guest) {
this.meetingID = meetingID;
this.internalUserId = internalUserId;
this.fullname = fullname;
this.role = role;
this.externUserID = externUserID;
this.authToken = authToken;
this.avatarURL = avatarURL;
this.guest = guest;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingID);
payload.put(Constants.INTERNAL_USER_ID, internalUserId);
payload.put(Constants.NAME, fullname);
payload.put(Constants.ROLE, role);
payload.put(Constants.EXT_USER_ID, externUserID);
payload.put(Constants.AUTH_TOKEN, authToken);
payload.put(Constants.AVATAR_URL, avatarURL);
payload.put(Constants.GUEST, guest.toString());
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(REGISTER_USER, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static RegisterUserMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (REGISTER_USER.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.NAME)
&& payload.has(Constants.ROLE)
&& payload.has(Constants.USER_ID)
&& payload.has(Constants.EXT_USER_ID)
&& payload.has(Constants.AUTH_TOKEN)
&& payload.has(Constants.GUEST)) {
String meetingID = payload.get(Constants.MEETING_ID).getAsString();
String fullname = payload.get(Constants.NAME).getAsString();
String role = payload.get(Constants.ROLE).getAsString();
String userId = payload.get(Constants.USER_ID).getAsString();
String externUserID = payload.get(Constants.EXT_USER_ID).getAsString();
String authToken = payload.get(Constants.AUTH_TOKEN).getAsString();
String avatarURL = payload.get(Constants.AVATAR_URL).getAsString();
Boolean guest = payload.get(Constants.GUEST).getAsBoolean();
return new RegisterUserMessage(meetingID, userId, fullname, role, externUserID, authToken, avatarURL, guest);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,44 @@
package org.bigbluebutton.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.bigbluebutton.common.messages.Constants;
import org.bigbluebutton.common.messages.IBigBlueButtonMessage;
import org.bigbluebutton.common.messages.MessageBuilder;
public class RegisterUserMessage implements IBigBlueButtonMessage {
public static final String NAME = "register_user_request";
public final Header header;
public final Payload payload;
public RegisterUserMessage(Payload payload) {
this.header = new Header(NAME);
this.payload = payload;
}
public static class Payload {
public final String meetingId;
public final String userId;
public final String name;
public final String role;
public final String extUserId;
public final String authToken;
public final String avatarUrl;
public final Boolean guest;
public final Boolean authed;
public Payload(String meetingId, String userId, String name, String role,
String extUserId, String authToken, String avatarUrl, Boolean guest, Boolean authed) {
this.meetingId = meetingId;
this.userId = userId;
this.name = name;
this.role = role;
this.extUserId = extUserId;
this.authToken = authToken;
this.avatarUrl = avatarUrl;
this.guest = guest;
this.authed = authed;
}
}
}

View File

@ -32,7 +32,8 @@ public class UserSession {
public String role = null; public String role = null;
public String conference = null; public String conference = null;
public String room = null; public String room = null;
public String guest = "false"; public Boolean guest = false;
public Boolean authed = false;
public String voicebridge = null; public String voicebridge = null;
public String webvoiceconf = null; public String webvoiceconf = null;
public String mode = null; public String mode = null;

View File

@ -13,6 +13,7 @@ package org.bigbluebutton.core.model
internal var dialNumber:String; internal var dialNumber:String;
internal var role:String; internal var role:String;
internal var guest:Boolean; internal var guest:Boolean;
internal var authed:Boolean;
internal var customData:Object; internal var customData:Object;
public function MeBuilder(id: String, name: String) { public function MeBuilder(id: String, name: String) {
@ -65,6 +66,11 @@ package org.bigbluebutton.core.model
return this; return this;
} }
public function withAuthed(value: Boolean):MeBuilder {
authed = value;
return this;
}
public function withCustomData(value: Object):MeBuilder { public function withCustomData(value: Object):MeBuilder {
customData = value; customData = value;
return this; return this;

View File

@ -133,6 +133,7 @@ package org.bigbluebutton.main.model.users
response.internalUserId = result.response.internalUserID; response.internalUserId = result.response.internalUserID;
response.role = result.response.role; response.role = result.response.role;
response.guest = result.response.guest; response.guest = result.response.guest;
response.authed = result.response.authed;
response.room = result.response.room; response.room = result.response.room;
response.authToken = result.response.authToken; response.authToken = result.response.authToken;
response.record = result.response.record; response.record = result.response.record;
@ -171,7 +172,8 @@ package org.bigbluebutton.main.model.users
.withExternalId(response.externUserID).withToken(response.authToken) .withExternalId(response.externUserID).withToken(response.authToken)
.withLayout(response.defaultLayout).withWelcome(response.welcome) .withLayout(response.defaultLayout).withWelcome(response.welcome)
.withDialNumber(response.dialnumber).withRole(response.role) .withDialNumber(response.dialnumber).withRole(response.role)
.withCustomData(response.customData).withGuest(response.guest.toUpperCase() == "TRUE").build(); .withCustomData(response.customData).withGuest(response.guest)
.withAuthed(response.authed).build();
MeetingModel.getInstance().meeting = new MeetingBuilder(response.conference, response.conferenceName) MeetingModel.getInstance().meeting = new MeetingBuilder(response.conference, response.conferenceName)
.withDefaultLayout(response.defaultLayout).withVoiceConf(response.voiceBridge) .withDefaultLayout(response.defaultLayout).withVoiceConf(response.voiceBridge)

View File

@ -99,7 +99,7 @@ package org.bigbluebutton.main.model.users
UserManager.getInstance().getConference().setMyName(result.username); UserManager.getInstance().getConference().setMyName(result.username);
UserManager.getInstance().getConference().setMyRole(result.role); UserManager.getInstance().getConference().setMyRole(result.role);
UserManager.getInstance().getConference().setMyRoom(result.room); UserManager.getInstance().getConference().setMyRoom(result.room);
UserManager.getInstance().getConference().setGuest(result.guest == "true"); UserManager.getInstance().getConference().setGuest(result.guest);
UserManager.getInstance().getConference().setMyAuthToken(result.authToken); UserManager.getInstance().getConference().setMyAuthToken(result.authToken);
UserManager.getInstance().getConference().setMyCustomData(result.customdata); UserManager.getInstance().getConference().setMyCustomData(result.customdata);
UserManager.getInstance().getConference().setDefaultLayout(result.defaultLayout); UserManager.getInstance().getConference().setDefaultLayout(result.defaultLayout);
@ -124,7 +124,7 @@ package org.bigbluebutton.main.model.users
_conferenceParameters.isBreakout = result.isBreakout; _conferenceParameters.isBreakout = result.isBreakout;
_conferenceParameters.conference = result.conference; _conferenceParameters.conference = result.conference;
_conferenceParameters.username = result.username; _conferenceParameters.username = result.username;
_conferenceParameters.guest = (result.guest.toUpperCase() == "TRUE"); _conferenceParameters.guest = (result.guest);
_conferenceParameters.role = result.role; _conferenceParameters.role = result.role;
_conferenceParameters.room = result.room; _conferenceParameters.room = result.room;
_conferenceParameters.authToken = result.authToken; _conferenceParameters.authToken = result.authToken;

View File

@ -24,7 +24,7 @@ dependencies {
compile 'org.apache.poi:poi-ooxml:3.15' compile 'org.apache.poi:poi-ooxml:3.15'
compile 'com.zaxxer:nuprocess:1.1.0' compile 'com.zaxxer:nuprocess:1.1.0'
compile 'org.bigbluebutton:bbb-common-message:0.0.18-SNAPSHOT' compile 'org.bigbluebutton:bbb-common-message:0.0.19-SNAPSHOT'
compile 'org.bigbluebutton:bbb-common-web:0.0.1-SNAPSHOT' compile 'org.bigbluebutton:bbb-common-web:0.0.1-SNAPSHOT'
// Logging // Logging

View File

@ -253,11 +253,14 @@ class ApiController {
errors.missingParamError("checksum"); errors.missingParamError("checksum");
} }
String guest; Boolean guest = false;
if (!StringUtils.isEmpty(params.guest) && params.guest.equalsIgnoreCase("true")) { if (!StringUtils.isEmpty(params.guest)) {
guest = "true"; guest = Boolean.parseBoolean(params.guest)
} else { }
guest = "false";
Boolean authenticated = false;
if (!StringUtils.isEmpty(params.auth)) {
authenticated = Boolean.parseBoolean(params.auth)
} }
// Do we have a name for the user joining? If none, complain. // Do we have a name for the user joining? If none, complain.
@ -451,6 +454,7 @@ class ApiController {
us.record = meeting.isRecord() us.record = meeting.isRecord()
us.welcome = meeting.getWelcomeMessage() us.welcome = meeting.getWelcomeMessage()
us.guest = guest us.guest = guest
us.authed = authenticated
us.logoutUrl = meeting.getLogoutUrl(); us.logoutUrl = meeting.getLogoutUrl();
us.configXML = configxml; us.configXML = configxml;
@ -468,7 +472,8 @@ class ApiController {
meetingService.addUserSession(sessionToken, us); meetingService.addUserSession(sessionToken, us);
// Register user into the meeting. // Register user into the meeting.
meetingService.registerUser(us.meetingID, us.internalUserId, us.fullname, us.role, us.externUserID, us.authToken, us.avatarURL, us.guest) meetingService.registerUser(us.meetingID, us.internalUserId, us.fullname, us.role, us.externUserID,
us.authToken, us.avatarURL, us.guest, us.authed)
// Validate if the maxParticipants limit has been reached based on registeredUsers. If so, complain. // Validate if the maxParticipants limit has been reached based on registeredUsers. If so, complain.
// when maxUsers is set to 0, the validation is ignored // when maxUsers is set to 0, the validation is ignored

View File

@ -113,9 +113,9 @@ public class MeetingService implements MessageListener {
public void registerUser(String meetingID, String internalUserId, public void registerUser(String meetingID, String internalUserId,
String fullname, String role, String externUserID, String fullname, String role, String externUserID,
String authToken, String avatarURL, String guest) { String authToken, String avatarURL, Boolean guest, Boolean authed) {
handle(new RegisterUser(meetingID, internalUserId, fullname, role, handle(new RegisterUser(meetingID, internalUserId, fullname, role,
externUserID, authToken, avatarURL, guest)); externUserID, authToken, avatarURL, guest, authed));
} }
public UserSession getUserSession(String token) { public UserSession getUserSession(String token) {
@ -367,7 +367,7 @@ public class MeetingService implements MessageListener {
private void processRegisterUser(RegisterUser message) { private void processRegisterUser(RegisterUser message) {
messagingService.registerUser(message.meetingID, messagingService.registerUser(message.meetingID,
message.internalUserId, message.fullname, message.role, message.internalUserId, message.fullname, message.role,
message.externUserID, message.authToken, message.avatarURL, message.guest); message.externUserID, message.authToken, message.avatarURL, message.guest, message.authed);
} }
public Meeting getMeeting(String meetingId) { public Meeting getMeeting(String meetingId) {

View File

@ -6,28 +6,13 @@ import org.bigbluebutton.api.messaging.converters.messages.CreateMeetingMessage;
import org.bigbluebutton.api.messaging.converters.messages.DestroyMeetingMessage; import org.bigbluebutton.api.messaging.converters.messages.DestroyMeetingMessage;
import org.bigbluebutton.api.messaging.converters.messages.EndMeetingMessage; import org.bigbluebutton.api.messaging.converters.messages.EndMeetingMessage;
import org.bigbluebutton.api.messaging.converters.messages.KeepAliveMessage; import org.bigbluebutton.api.messaging.converters.messages.KeepAliveMessage;
import org.bigbluebutton.api.messaging.converters.messages.RegisterUserMessage;
import org.bigbluebutton.api.messaging.converters.messages.PublishRecordingMessage; import org.bigbluebutton.api.messaging.converters.messages.PublishRecordingMessage;
import org.bigbluebutton.api.messaging.converters.messages.UnpublishRecordingMessage; import org.bigbluebutton.api.messaging.converters.messages.UnpublishRecordingMessage;
import org.bigbluebutton.api.messaging.converters.messages.DeleteRecordingMessage; import org.bigbluebutton.api.messaging.converters.messages.DeleteRecordingMessage;
public class MessageToJson { public class MessageToJson {
public static String registerUserToJson(RegisterUserMessage message) {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, message.meetingID);
payload.put(Constants.NAME, message.fullname);
payload.put(Constants.USER_ID, message.internalUserId);
payload.put(Constants.ROLE, message.role);
payload.put(Constants.EXT_USER_ID, message.externUserID);
payload.put(Constants.AUTH_TOKEN, message.authToken);
payload.put(Constants.AVATAR_URL, message.avatarURL);
payload.put(Constants.GUEST, message.guest);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(RegisterUserMessage.REGISTER_USER, message.VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static String createMeetingMessageToJson(CreateMeetingMessage msg) { public static String createMeetingMessageToJson(CreateMeetingMessage msg) {
HashMap<String, Object> payload = new HashMap<String, Object>(); HashMap<String, Object> payload = new HashMap<String, Object>();

View File

@ -40,7 +40,8 @@ public interface MessagingService {
void endMeeting(String meetingId); void endMeeting(String meetingId);
void send(String channel, String message); void send(String channel, String message);
void sendPolls(String meetingId, String title, String question, String questionType, List<String> answers); void sendPolls(String meetingId, String title, String question, String questionType, List<String> answers);
void registerUser(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken, String avatarURL, String guest); void registerUser(String meetingID, String internalUserId, String fullname, String role, String externUserID,
String authToken, String avatarURL, Boolean guest, Boolean authed);
void sendKeepAlive(String system, Long timestamp); void sendKeepAlive(String system, Long timestamp);
void sendStunTurnInfo(String meetingId, String internalUserId, Set<StunServer> stuns, Set<TurnEntry> turns); void sendStunTurnInfo(String meetingId, String internalUserId, Set<StunServer> stuns, Set<TurnEntry> turns);
void publishRecording(String recordId, String meetingId, String externalMeetingId, String format, boolean publish); void publishRecording(String recordId, String meetingId, String externalMeetingId, String format, boolean publish);

View File

@ -28,7 +28,7 @@ import java.util.Set;
import org.bigbluebutton.api.messaging.converters.messages.DestroyMeetingMessage; import org.bigbluebutton.api.messaging.converters.messages.DestroyMeetingMessage;
import org.bigbluebutton.api.messaging.converters.messages.EndMeetingMessage; import org.bigbluebutton.api.messaging.converters.messages.EndMeetingMessage;
import org.bigbluebutton.api.messaging.converters.messages.RegisterUserMessage; import org.bigbluebutton.messages.RegisterUserMessage;
import org.bigbluebutton.api.messaging.converters.messages.PublishRecordingMessage; import org.bigbluebutton.api.messaging.converters.messages.PublishRecordingMessage;
import org.bigbluebutton.api.messaging.converters.messages.UnpublishRecordingMessage; import org.bigbluebutton.api.messaging.converters.messages.UnpublishRecordingMessage;
import org.bigbluebutton.api.messaging.converters.messages.DeleteRecordingMessage; import org.bigbluebutton.api.messaging.converters.messages.DeleteRecordingMessage;
@ -71,10 +71,15 @@ public class RedisMessagingService implements MessagingService {
sender.send(MessagingConstants.TO_MEETING_CHANNEL, json); sender.send(MessagingConstants.TO_MEETING_CHANNEL, json);
} }
public void registerUser(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken, String avatarURL, String guest) { public void registerUser(String meetingID, String internalUserId, String fullname, String role,
RegisterUserMessage msg = new RegisterUserMessage(meetingID, internalUserId, fullname, role, externUserID, authToken, avatarURL, guest); String externUserID, String authToken, String avatarURL, Boolean guest, Boolean authed) {
String json = MessageToJson.registerUserToJson(msg); RegisterUserMessage.Payload payload = new RegisterUserMessage.Payload(meetingID, internalUserId, fullname, role, externUserID,
log.info("Sending register user message to bbb-apps:[{}]", json); authToken, avatarURL, guest, authed);
RegisterUserMessage msg = new RegisterUserMessage(payload);
Gson gson = new Gson();
String json = gson.toJson(msg);
log.info("*****Sending register user message to bbb-apps:[{}]", json);
sender.send(MessagingConstants.TO_MEETING_CHANNEL, json); sender.send(MessagingConstants.TO_MEETING_CHANNEL, json);
} }

View File

@ -1,26 +0,0 @@
package org.bigbluebutton.api.messaging.converters.messages;
public class RegisterUserMessage {
public static final String REGISTER_USER = "register_user_request";
public final String VERSION = "0.0.1";
public final String meetingID;
public final String internalUserId;
public final String fullname;
public final String role;
public final String externUserID;
public final String authToken;
public final String avatarURL;
public final String guest;
public RegisterUserMessage(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken, String avatarURL, String guest) {
this.meetingID = meetingID;
this.internalUserId = internalUserId;
this.fullname = fullname;
this.role = role;
this.externUserID = externUserID;
this.authToken = authToken;
this.avatarURL = avatarURL;
this.guest = guest;
}
}

View File

@ -1,5 +1,6 @@
package org.bigbluebutton.api.messaging.messages; package org.bigbluebutton.api.messaging.messages;
public class RegisterUser implements IMessage { public class RegisterUser implements IMessage {
public final String meetingID; public final String meetingID;
@ -9,9 +10,11 @@ public class RegisterUser implements IMessage {
public final String externUserID; public final String externUserID;
public final String authToken; public final String authToken;
public final String avatarURL; public final String avatarURL;
public final String guest; public final Boolean guest;
public final Boolean authed;
public RegisterUser(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken, String avatarURL, String guest) { public RegisterUser(String meetingID, String internalUserId, String fullname, String role, String externUserID,
String authToken, String avatarURL, Boolean guest, Boolean authed) {
this.meetingID = meetingID; this.meetingID = meetingID;
this.internalUserId = internalUserId; this.internalUserId = internalUserId;
this.fullname = fullname; this.fullname = fullname;
@ -20,5 +23,6 @@ public class RegisterUser implements IMessage {
this.authToken = authToken; this.authToken = authToken;
this.avatarURL = avatarURL; this.avatarURL = avatarURL;
this.guest = guest; this.guest = guest;
this.authed = authed;
} }
} }