Remove endpoint /enter of bbb-web

This commit is contained in:
Gustavo Trott 2024-07-11 11:14:46 -03:00
parent 7a03136d02
commit 25857dc509
11 changed files with 7 additions and 285 deletions

View File

@ -1,4 +1,5 @@
#!/bin/bash
set -e
#Publish new common-message .jar
sbt clean

View File

@ -1,4 +1,5 @@
#!/bin/bash
set -e
#Publish new bbb-common-web .jar
sbt clean

View File

@ -1,61 +0,0 @@
package org.bigbluebutton.api.model.request;
import jakarta.ws.rs.core.MediaType;
import org.bigbluebutton.api.model.constraint.*;
import org.bigbluebutton.api.service.SessionService;
import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotNull;
import java.util.Map;
import java.util.Set;
@ContentTypeConstraint
public class Enter extends RequestWithSession<Enter.Params>{
public enum Params implements RequestParameters {
SESSION_TOKEN("sessionToken");
private final String value;
Params(String value) { this.value = value; }
public String getValue() { return value; }
}
@UserSessionConstraint
@GuestPolicyConstraint
private String sessionToken;
@MeetingExistsConstraint
@MeetingEndedConstraint
private String meetingID;
private SessionService sessionService;
public Enter(HttpServletRequest servletRequest) {
super(servletRequest);
sessionService = new SessionService();
}
public String getSessionToken() {
return sessionToken;
}
public void setSessionToken(String sessionToken) {
this.sessionToken = sessionToken;
}
@Override
public void populateFromParamsMap(Map<String, String[]> params) {
if(params.containsKey(Params.SESSION_TOKEN.getValue())) {
setSessionToken(params.get(Params.SESSION_TOKEN.getValue())[0]);
sessionService.setSessionToken(sessionToken);
meetingID = sessionService.getMeetingID();
}
}
@Override
public void convertParamsFromString() {
}
}

View File

@ -35,7 +35,7 @@ public class SignOut extends RequestWithSession<SignOut.Params> {
@Override
public void populateFromParamsMap(Map<String, String[]> params) {
if(params.containsKey(Enter.Params.SESSION_TOKEN.getValue())) setSessionToken(params.get(Enter.Params.SESSION_TOKEN.getValue())[0]);
if(params.containsKey(SignOut.Params.SESSION_TOKEN.getValue())) setSessionToken(params.get(SignOut.Params.SESSION_TOKEN.getValue())[0]);
}
@Override

View File

@ -43,8 +43,8 @@ public class Stuns extends RequestWithSession<Stuns.Params> {
@Override
public void populateFromParamsMap(Map<String, String[]> params) {
if(params.containsKey(Enter.Params.SESSION_TOKEN.getValue())) {
setSessionToken(params.get(Enter.Params.SESSION_TOKEN.getValue())[0]);
if(params.containsKey(Stuns.Params.SESSION_TOKEN.getValue())) {
setSessionToken(params.get(Stuns.Params.SESSION_TOKEN.getValue())[0]);
sessionService.setSessionToken(sessionToken);
meetingID = sessionService.getMeetingID();
}

View File

@ -39,7 +39,6 @@ public class ValidationService {
GET_MEETINGS("getMeetings", RequestType.GET),
GET_SESSIONS("getSessions", RequestType.GET),
GUEST_WAIT("guestWait", RequestType.GET),
ENTER("enter", RequestType.GET),
STUNS("stuns", RequestType.GET),
SIGN_OUT("signOut", RequestType.GET),
LEARNING_DASHBOARD("learningDashboard", RequestType.GET),
@ -126,7 +125,6 @@ public class ValidationService {
case INSERT_DOCUMENT -> new InsertDocument(checksum, servletRequest);
case SEND_CHAT_MESSAGE -> new SendChatMessage(checksum, servletRequest);
case GUEST_WAIT -> new GuestWait(servletRequest);
case ENTER -> new Enter(servletRequest);
case STUNS -> new Stuns(servletRequest);
case SIGN_OUT -> new SignOut(servletRequest);
case LEARNING_DASHBOARD -> new LearningDashboard(servletRequest);

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
set -e
gradle clean
gradle resolveDeps
grails clean

View File

@ -91,10 +91,6 @@ class UrlMappings {
action = [GET: 'getSessionsHandler', POST: 'getSessionsHandler']
}
"/bigbluebutton/api/enter"(controller: "api") {
action = [GET: 'enter', POST: 'enter']
}
"/bigbluebutton/api/stuns"(controller: "api") {
action = [GET: 'stuns', POST: 'stuns']
}

View File

@ -738,156 +738,6 @@ class ApiController {
return reqParams;
}
/***********************************************
* ENTER API
***********************************************/
def enter = {
String API_CALL = 'enter'
log.debug CONTROLLER_NAME + "#${API_CALL}"
String respMessage = "Session not found."
String respMessageKey = "missingSession"
boolean reject = false;
String sessionToken
UserSession us
Meeting meeting
Map.Entry<String, String> validationResponse = validateRequest(
ValidationService.ApiCall.ENTER,
request
)
if(!(validationResponse == null)) {
respMessage = validationResponse.getValue()
respMessageKey = validationResponse.getKey()
reject = true
} else {
sessionToken = sanitizeSessionToken(params.sessionToken)
us = getUserSession(sessionToken)
meeting = meetingService.getMeeting(us.meetingID)
if (!hasValidSession(sessionToken)) {
reject = true;
} else {
if(hasReachedMaxParticipants(meeting, us)) {
reject = true
respMessage = "The maximum number of participants allowed for this meeting has been reached."
respMessageKey = "maxParticipantsReached"
} else {
log.info("User ${us.internalUserId} has entered")
meeting.userEntered(us.internalUserId)
}
}
}
if (reject) {
// Determine the logout url so we can send the user there.
String logoutUrl = paramsProcessorUtil.getDefaultLogoutUrl()
if(us != null) {
logoutUrl = us.logoutUrl
}
log.info("Session token: ${sessionToken}")
response.addHeader("Cache-Control", "no-cache")
withFormat {
json {
def builder = new JsonBuilder()
builder.response {
returncode RESP_CODE_FAILED
message respMessage
messageKey respMessageKey
sessionToken
logoutURL logoutUrl
}
render(contentType: "application/json", text: builder.toPrettyString())
}
}
} else {
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingid", us.meetingID);
logData.put("extMeetingid", us.externMeetingID);
logData.put("name", us.fullname);
logData.put("userid", us.internalUserId);
logData.put("sessionToken", sessionToken);
logData.put("logCode", "handle_enter_api");
logData.put("description", "Handling ENTER API.");
Gson gson = new Gson();
String logStr = gson.toJson(logData);
log.info(" --analytics-- data=" + logStr);
response.addHeader("Cache-Control", "no-cache")
withFormat {
json {
def builder = new JsonBuilder()
builder.response {
returncode RESP_CODE_SUCCESS
fullname us.fullname
confname us.conferencename
meetingID us.meetingID
externMeetingID us.externMeetingID
externUserID us.externUserID
internalUserID us.internalUserId
authToken us.authToken
role us.role
guest us.guest
guestStatus us.guestStatus
conference us.conference
room us.room
voicebridge us.voicebridge
dialnumber meeting.getDialNumber()
webvoiceconf us.webvoiceconf
mode us.mode
record us.record
isBreakout meeting.isBreakout()
logoutTimer meeting.getLogoutTimer()
allowStartStopRecording meeting.getAllowStartStopRecording()
recordFullDurationMedia meeting.getRecordFullDurationMedia()
welcome us.welcome
if (!StringUtils.isEmpty(meeting.moderatorOnlyMessage) && us.role.equals(ROLE_MODERATOR)) {
modOnlyMessage meeting.moderatorOnlyMessage
}
if (!StringUtils.isEmpty(meeting.bannerText)) {
bannerText meeting.getBannerText()
bannerColor meeting.getBannerColor()
}
customLogoURL meeting.getCustomLogoURL()
customCopyright meeting.getCustomCopyright()
muteOnStart meeting.getMuteOnStart()
allowModsToUnmuteUsers meeting.getAllowModsToUnmuteUsers()
logoutUrl us.logoutUrl
defaultLayout us.defaultLayout
avatarURL us.avatarURL
if (meeting.breakoutRoomsParams != null) {
breakoutRooms {
record meeting.breakoutRoomsParams.record
privateChatEnabled meeting.breakoutRoomsParams.privateChatEnabled
captureNotes meeting.breakoutRoomsParams.captureNotes
captureSlides meeting.breakoutRoomsParams.captureSlides
captureNotesFilename meeting.breakoutRoomsParams.captureNotesFilename
captureSlidesFilename meeting.breakoutRoomsParams.captureSlidesFilename
}
}
customdata (
meeting.getUserCustomData(us.externUserID).collect { k, v ->
["$k": v]
}
)
metadata (
meeting.getMetadata().collect { k, v ->
["$k": v]
}
)
}
render(contentType: "application/json", text: builder.toPrettyString())
}
}
}
}
/***********************************************
* STUN/TURN API
***********************************************/

View File

@ -5,47 +5,6 @@
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "enter",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonResponse = pm.response.json();",
"",
"console.log(jsonResponse)",
"",
"pm.test(\"Return code is SUCCESS\", function () {",
" pm.expect(jsonResponse.response.returncode).to.eql(\"FAILED\");",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/{{path}}/enter?{{param_session_token}}=",
"host": [
"{{base_url}}"
],
"path": [
"{{path}}",
"enter"
],
"query": [
{
"key": "{{param_session_token}}",
"value": ""
}
]
}
},
"response": []
},
{
"name": "guestWait",
"event": [

View File

@ -158,30 +158,6 @@
},
"response": []
},
{
"name": "enter",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/{{path}}/enter?{{param_session_token}}={{session_token}}",
"host": [
"{{base_url}}"
],
"path": [
"{{path}}",
"enter"
],
"query": [
{
"key": "{{param_session_token}}",
"value": "{{session_token}}"
}
]
}
},
"response": []
},
{
"name": "isMeetingRunning",
"event": [