introduce-allowPromoteGuestToModerator27

This commit is contained in:
Gustavo Trott 2024-06-04 11:36:46 -03:00
parent 496a42ff90
commit 37d6aa0140
16 changed files with 80 additions and 27 deletions

View File

@ -30,7 +30,7 @@ trait ChangeUserRoleCmdMsgHdlr extends RightsManagementTrait {
} yield { } yield {
RegisteredUsers.updateUserRole(liveMeeting.registeredUsers, u, userRole) RegisteredUsers.updateUserRole(liveMeeting.registeredUsers, u, userRole)
} }
val promoteGuest = !liveMeeting.props.usersProp.authenticatedGuest val promoteGuest = !liveMeeting.props.usersProp.authenticatedGuest || liveMeeting.props.usersProp.allowPromoteGuestToModerator
if (msg.body.role == Roles.MODERATOR_ROLE && (!uvo.guest || promoteGuest)) { if (msg.body.role == Roles.MODERATOR_ROLE && (!uvo.guest || promoteGuest)) {
// Promote non-guest users. // Promote non-guest users.
val notifyEvent = MsgBuilder.buildNotifyUserInMeetingEvtMsg( val notifyEvent = MsgBuilder.buildNotifyUserInMeetingEvtMsg(

View File

@ -44,6 +44,7 @@ trait AppsTestFixtures {
val allowModsToUnmuteUsers = false val allowModsToUnmuteUsers = false
val allowModsToEjectCameras = false val allowModsToEjectCameras = false
val authenticatedGuest = false val authenticatedGuest = false
val allowPromoteGuestToModerator = false
val meetingLayout = "" val meetingLayout = ""
val captureNotesFilename = s"Room 0${sequence} (Notes)" val captureNotesFilename = s"Room 0${sequence} (Notes)"
val captureSlidesFilename = s"Room 0${sequence} (Whiteboard)" val captureSlidesFilename = s"Room 0${sequence} (Whiteboard)"
@ -70,7 +71,7 @@ trait AppsTestFixtures {
val usersProp = UsersProp(maxUsers = maxUsers, webcamsOnlyForModerator = webcamsOnlyForModerator, val usersProp = UsersProp(maxUsers = maxUsers, webcamsOnlyForModerator = webcamsOnlyForModerator,
userCameraCap = userCameraCap, userCameraCap = userCameraCap,
guestPolicy = guestPolicy, allowModsToUnmuteUsers = allowModsToUnmuteUsers, allowModsToEjectCameras = allowModsToEjectCameras, guestPolicy = guestPolicy, allowModsToUnmuteUsers = allowModsToUnmuteUsers, allowModsToEjectCameras = allowModsToEjectCameras,
authenticatedGuest = authenticatedGuest, meetingLayout = meetingLayout) authenticatedGuest = authenticatedGuest, allowPromoteGuestToModerator = allowPromoteGuestToModerator, meetingLayout = meetingLayout)
val metadataProp = new MetadataProp(metadata) val metadataProp = new MetadataProp(metadata)
val defaultProps = DefaultProps(meetingProp, breakoutProps, durationProps, password, recordProp, welcomeProp, voiceProp, val defaultProps = DefaultProps(meetingProp, breakoutProps, durationProps, password, recordProp, welcomeProp, voiceProp,

View File

@ -49,7 +49,8 @@ case class UsersProp(
meetingLayout: String, meetingLayout: String,
allowModsToUnmuteUsers: Boolean, allowModsToUnmuteUsers: Boolean,
allowModsToEjectCameras: Boolean, allowModsToEjectCameras: Boolean,
authenticatedGuest: Boolean authenticatedGuest: Boolean,
allowPromoteGuestToModerator: Boolean
) )
case class MetadataProp(metadata: collection.immutable.Map[String, String]) case class MetadataProp(metadata: collection.immutable.Map[String, String])

View File

@ -44,6 +44,7 @@ trait TestFixtures {
val keepEvents = false val keepEvents = false
val guestPolicy = "ALWAYS_ASK" val guestPolicy = "ALWAYS_ASK"
val authenticatedGuest = false val authenticatedGuest = false
val allowPromoteGuestToModerator = false
val metadata: collection.immutable.Map[String, String] = Map("foo" -> "bar", "bar" -> "baz", "baz" -> "foo") val metadata: collection.immutable.Map[String, String] = Map("foo" -> "bar", "bar" -> "baz", "baz" -> "foo")
val captureNotesFilename = s"Room 0${sequence} (Notes)" val captureNotesFilename = s"Room 0${sequence} (Notes)"
val captureSlidesFilename = s"Room 0${sequence} (Whiteboard)" val captureSlidesFilename = s"Room 0${sequence} (Whiteboard)"
@ -71,7 +72,8 @@ trait TestFixtures {
val voiceProp = VoiceProp(telVoice = voiceConfId, voiceConf = voiceConfId, dialNumber = dialNumber, muteOnStart = muteOnStart) val voiceProp = VoiceProp(telVoice = voiceConfId, voiceConf = voiceConfId, dialNumber = dialNumber, muteOnStart = muteOnStart)
val usersProp = UsersProp(maxUsers = maxUsers, webcamsOnlyForModerator = webcamsOnlyForModerator, val usersProp = UsersProp(maxUsers = maxUsers, webcamsOnlyForModerator = webcamsOnlyForModerator,
userCameraCap = userCameraCap, userCameraCap = userCameraCap,
guestPolicy = guestPolicy, allowModsToUnmuteUsers = allowModsToUnmuteUsers, allowModsToEjectCameras = allowModsToEjectCameras, authenticatedGuest = authenticatedGuest) guestPolicy = guestPolicy, allowModsToUnmuteUsers = allowModsToUnmuteUsers, allowModsToEjectCameras = allowModsToEjectCameras,
authenticatedGuest = authenticatedGuest, allowPromoteGuestToModerator = allowPromoteGuestToModerator)
val metadataProp = new MetadataProp(metadata) val metadataProp = new MetadataProp(metadata)
val defaultProps = DefaultProps(meetingProp, breakoutProps, durationProps, password, recordProp, welcomeProp, voiceProp, val defaultProps = DefaultProps(meetingProp, breakoutProps, durationProps, password, recordProp, welcomeProp, voiceProp,
usersProp, metadataProp) usersProp, metadataProp)

View File

@ -33,6 +33,7 @@ public class ApiParams {
public static final String FREE_JOIN = "freeJoin"; public static final String FREE_JOIN = "freeJoin";
public static final String FULL_NAME = "fullName"; public static final String FULL_NAME = "fullName";
public static final String GUEST_POLICY = "guestPolicy"; public static final String GUEST_POLICY = "guestPolicy";
public static final String ALLOW_PROMOTE_GUEST_TO_MODERATOR = "allowPromoteGuestToModerator";
public static final String MEETING_LAYOUT = "meetingLayout"; public static final String MEETING_LAYOUT = "meetingLayout";
public static final String IS_BREAKOUT = "isBreakout"; public static final String IS_BREAKOUT = "isBreakout";
public static final String LOGO = "logo"; public static final String LOGO = "logo";

View File

@ -401,10 +401,12 @@ public class MeetingService implements MessageListener {
gw.createMeeting(m.getInternalId(), m.getExternalId(), m.getParentMeetingId(), m.getName(), m.isRecord(), gw.createMeeting(m.getInternalId(), m.getExternalId(), m.getParentMeetingId(), m.getName(), m.isRecord(),
m.getTelVoice(), m.getDuration(), m.getAutoStartRecording(), m.getAllowStartStopRecording(), m.getTelVoice(), m.getDuration(), m.getAutoStartRecording(), m.getAllowStartStopRecording(),
m.getRecordFullDurationMedia(), m.getRecordFullDurationMedia(),
m.getWebcamsOnlyForModerator(), m.getMeetingCameraCap(), m.getUserCameraCap(), m.getMaxPinnedCameras(), m.getModeratorPassword(), m.getViewerPassword(), m.getWebcamsOnlyForModerator(), m.getMeetingCameraCap(), m.getUserCameraCap(), m.getMaxPinnedCameras(),
m.getModeratorPassword(), m.getViewerPassword(),
m.getLearningDashboardAccessToken(), m.getCreateTime(), m.getLearningDashboardAccessToken(), m.getCreateTime(),
formatPrettyDate(m.getCreateTime()), m.isBreakout(), m.getSequence(), m.isFreeJoin(), m.getMetadata(), formatPrettyDate(m.getCreateTime()), m.isBreakout(), m.getSequence(), m.isFreeJoin(), m.getMetadata(),
m.getGuestPolicy(), m.getAuthenticatedGuest(), m.getMeetingLayout(), m.getWelcomeMessageTemplate(), m.getWelcomeMessage(), m.getModeratorOnlyMessage(), m.getGuestPolicy(), m.getAuthenticatedGuest(), m.getAllowPromoteGuestToModerator(), m.getMeetingLayout(),
m.getWelcomeMessageTemplate(), m.getWelcomeMessage(), m.getModeratorOnlyMessage(),
m.getDialNumber(), m.getMaxUsers(), m.getMaxUserConcurrentAccesses(), m.getDialNumber(), m.getMaxUsers(), m.getMaxUserConcurrentAccesses(),
m.getMeetingExpireIfNoUserJoinedInMinutes(), m.getMeetingExpireWhenLastUserLeftInMinutes(), m.getMeetingExpireIfNoUserJoinedInMinutes(), m.getMeetingExpireWhenLastUserLeftInMinutes(),
m.getUserInactivityInspectTimerInMinutes(), m.getUserInactivityThresholdInMinutes(), m.getUserInactivityInspectTimerInMinutes(), m.getUserInactivityThresholdInMinutes(),

View File

@ -86,6 +86,7 @@ public class ParamsProcessorUtil {
private String defaultAvatarURL; private String defaultAvatarURL;
private String defaultGuestPolicy; private String defaultGuestPolicy;
private Boolean authenticatedGuest; private Boolean authenticatedGuest;
private Boolean defaultAllowPromoteGuestToModerator;
private String defaultMeetingLayout; private String defaultMeetingLayout;
private int defaultMeetingDuration; private int defaultMeetingDuration;
private boolean disableRecordingDefault; private boolean disableRecordingDefault;
@ -678,6 +679,11 @@ public class ParamsProcessorUtil {
guestPolicy = params.get(ApiParams.GUEST_POLICY); guestPolicy = params.get(ApiParams.GUEST_POLICY);
} }
Boolean allowPromoteGuestToModerator = defaultAllowPromoteGuestToModerator;
if (!StringUtils.isEmpty(params.get(ApiParams.ALLOW_PROMOTE_GUEST_TO_MODERATOR))) {
allowPromoteGuestToModerator = Boolean.parseBoolean(params.get(ApiParams.ALLOW_PROMOTE_GUEST_TO_MODERATOR));
}
String presentationUploadExternalDescription = defaultPresentationUploadExternalDescription; String presentationUploadExternalDescription = defaultPresentationUploadExternalDescription;
if (!StringUtils.isEmpty(params.get(ApiParams.PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION))) { if (!StringUtils.isEmpty(params.get(ApiParams.PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION))) {
presentationUploadExternalDescription = params.get(ApiParams.PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION); presentationUploadExternalDescription = params.get(ApiParams.PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION);
@ -766,6 +772,7 @@ public class ParamsProcessorUtil {
.withWelcomeMessage(welcomeMessage).isBreakout(isBreakout) .withWelcomeMessage(welcomeMessage).isBreakout(isBreakout)
.withGuestPolicy(guestPolicy) .withGuestPolicy(guestPolicy)
.withAuthenticatedGuest(authenticatedGuest) .withAuthenticatedGuest(authenticatedGuest)
.withAllowPromoteGuestToModerator(allowPromoteGuestToModerator)
.withAllowRequestsWithoutSession(allowRequestsWithoutSession) .withAllowRequestsWithoutSession(allowRequestsWithoutSession)
.withMeetingLayout(meetingLayout) .withMeetingLayout(meetingLayout)
.withBreakoutRoomsParams(breakoutParams) .withBreakoutRoomsParams(breakoutParams)
@ -1297,6 +1304,10 @@ public class ParamsProcessorUtil {
this.authenticatedGuest = value; this.authenticatedGuest = value;
} }
public void setDefaultAllowPromoteGuestToModerator(Boolean value) {
this.defaultAllowPromoteGuestToModerator = value;
}
public void setDefaultMeetingLayout(String meetingLayout) { public void setDefaultMeetingLayout(String meetingLayout) {
this.defaultMeetingLayout = meetingLayout; this.defaultMeetingLayout = meetingLayout;
} }

View File

@ -83,6 +83,7 @@ public class Meeting {
private String guestLobbyMessage = ""; private String guestLobbyMessage = "";
private Map<String,String> usersWithGuestLobbyMessages; private Map<String,String> usersWithGuestLobbyMessages;
private Boolean authenticatedGuest = false; private Boolean authenticatedGuest = false;
private Boolean allowPromoteGuestToModerator = false;
private String meetingLayout = MeetingLayout.SMART_LAYOUT; private String meetingLayout = MeetingLayout.SMART_LAYOUT;
private boolean userHasJoined = false; private boolean userHasJoined = false;
private Map<String, String> guestUsersWithPositionInWaitingLine; private Map<String, String> guestUsersWithPositionInWaitingLine;
@ -166,6 +167,7 @@ public class Meeting {
isBreakout = builder.isBreakout; isBreakout = builder.isBreakout;
guestPolicy = builder.guestPolicy; guestPolicy = builder.guestPolicy;
authenticatedGuest = builder.authenticatedGuest; authenticatedGuest = builder.authenticatedGuest;
allowPromoteGuestToModerator = builder.allowPromoteGuestToModerator;
meetingLayout = builder.meetingLayout; meetingLayout = builder.meetingLayout;
allowRequestsWithoutSession = builder.allowRequestsWithoutSession; allowRequestsWithoutSession = builder.allowRequestsWithoutSession;
breakoutRoomsParams = builder.breakoutRoomsParams; breakoutRoomsParams = builder.breakoutRoomsParams;
@ -499,6 +501,14 @@ public class Meeting {
return authenticatedGuest; return authenticatedGuest;
} }
public void setAllowPromoteGuestToModerator(Boolean value) {
allowPromoteGuestToModerator = value;
}
public Boolean getAllowPromoteGuestToModerator() {
return allowPromoteGuestToModerator;
}
public void setMeetingLayout(String layout) { public void setMeetingLayout(String layout) {
meetingLayout = layout; meetingLayout = layout;
} }
@ -903,6 +913,7 @@ public class Meeting {
private boolean isBreakout; private boolean isBreakout;
private String guestPolicy; private String guestPolicy;
private Boolean authenticatedGuest; private Boolean authenticatedGuest;
private Boolean allowPromoteGuestToModerator;
private Boolean allowRequestsWithoutSession; private Boolean allowRequestsWithoutSession;
private String meetingLayout; private String meetingLayout;
private BreakoutRoomsParams breakoutRoomsParams; private BreakoutRoomsParams breakoutRoomsParams;
@ -1085,6 +1096,11 @@ public class Meeting {
return this; return this;
} }
public Builder withAllowPromoteGuestToModerator(Boolean value) {
allowPromoteGuestToModerator = value;
return this;
}
public Builder withAllowRequestsWithoutSession(Boolean value) { public Builder withAllowRequestsWithoutSession(Boolean value) {
allowRequestsWithoutSession = value; allowRequestsWithoutSession = value;
return this; return this;

View File

@ -26,7 +26,8 @@ public interface IBbbWebApiGWApp {
Integer maxPinnedCameras, Integer maxPinnedCameras,
String moderatorPass, String viewerPass, String learningDashboardAccessToken, Long createTime, String moderatorPass, String viewerPass, String learningDashboardAccessToken, Long createTime,
String createDate, Boolean isBreakout, Integer sequence, Boolean freejoin, Map<String, String> metadata, String createDate, Boolean isBreakout, Integer sequence, Boolean freejoin, Map<String, String> metadata,
String guestPolicy, Boolean authenticatedGuest, String meetingLayout, String welcomeMsgTemplate, String welcomeMsg, String modOnlyMessage, String guestPolicy, Boolean authenticatedGuest, Boolean allowPromoteGuestToModerator, String meetingLayout,
String welcomeMsgTemplate, String welcomeMsg, String modOnlyMessage,
String dialNumber, Integer maxUsers, Integer maxUserConcurrentAccesses, String dialNumber, Integer maxUsers, Integer maxUserConcurrentAccesses,
Integer meetingExpireIfNoUserJoinedInMinutes, Integer meetingExpireIfNoUserJoinedInMinutes,
Integer meetingExpireWhenLastUserLeftInMinutes, Integer meetingExpireWhenLastUserLeftInMinutes,

View File

@ -7,6 +7,7 @@ public class UsersProp2 {
public final String guestPolicy; public final String guestPolicy;
public final String meetingLayout; public final String meetingLayout;
public final boolean authenticatedGuest; public final boolean authenticatedGuest;
public final boolean allowPromoteGuestToModerator;
public final boolean userHasJoined; public final boolean userHasJoined;
public final boolean webcamsOnlyForModerator; public final boolean webcamsOnlyForModerator;
public final int userCameraCap; public final int userCameraCap;
@ -21,6 +22,7 @@ public class UsersProp2 {
String guestPolicy, String guestPolicy,
String meetingLayout, String meetingLayout,
boolean authenticatedGuest, boolean authenticatedGuest,
boolean allowPromoteGuestToModerator,
boolean userHasJoined, boolean userHasJoined,
Map<String, String> userCustomData, Map<String, String> userCustomData,
Map<String, User2> users, Map<String, User2> users,
@ -31,6 +33,7 @@ public class UsersProp2 {
this.guestPolicy = guestPolicy; this.guestPolicy = guestPolicy;
this.meetingLayout = meetingLayout; this.meetingLayout = meetingLayout;
this.authenticatedGuest = authenticatedGuest; this.authenticatedGuest = authenticatedGuest;
this.allowPromoteGuestToModerator = allowPromoteGuestToModerator;
this.userHasJoined = userHasJoined; this.userHasJoined = userHasJoined;
this.userCustomData = userCustomData; this.userCustomData = userCustomData;
this.users = users; this.users = users;

View File

@ -130,7 +130,10 @@ class BbbWebApiGWApp(
createTime: java.lang.Long, createDate: String, isBreakout: java.lang.Boolean, createTime: java.lang.Long, createDate: String, isBreakout: java.lang.Boolean,
sequence: java.lang.Integer, sequence: java.lang.Integer,
freeJoin: java.lang.Boolean, freeJoin: java.lang.Boolean,
metadata: java.util.Map[String, String], guestPolicy: String, authenticatedGuest: java.lang.Boolean, meetingLayout: String, metadata: java.util.Map[String, String], guestPolicy: String,
authenticatedGuest: java.lang.Boolean,
allowPromoteGuestToModerator: java.lang.Boolean,
meetingLayout: String,
welcomeMsgTemplate: String, welcomeMsg: String, modOnlyMessage: String, welcomeMsgTemplate: String, welcomeMsg: String, modOnlyMessage: String,
dialNumber: String, dialNumber: String,
maxUsers: java.lang.Integer, maxUsers: java.lang.Integer,
@ -211,7 +214,8 @@ class BbbWebApiGWApp(
userCameraCap = userCameraCap.intValue(), userCameraCap = userCameraCap.intValue(),
guestPolicy = guestPolicy, meetingLayout = meetingLayout, allowModsToUnmuteUsers = allowModsToUnmuteUsers.booleanValue(), guestPolicy = guestPolicy, meetingLayout = meetingLayout, allowModsToUnmuteUsers = allowModsToUnmuteUsers.booleanValue(),
allowModsToEjectCameras = allowModsToEjectCameras.booleanValue(), allowModsToEjectCameras = allowModsToEjectCameras.booleanValue(),
authenticatedGuest = authenticatedGuest.booleanValue() authenticatedGuest = authenticatedGuest.booleanValue(),
allowPromoteGuestToModerator = allowPromoteGuestToModerator.booleanValue()
) )
val metadataProp = MetadataProp(mapAsScalaMap(metadata).toMap) val metadataProp = MetadataProp(mapAsScalaMap(metadata).toMap)

View File

@ -100,6 +100,7 @@ export default async function addMeeting(meeting) {
userCameraCap: Number, userCameraCap: Number,
guestPolicy: String, guestPolicy: String,
authenticatedGuest: Boolean, authenticatedGuest: Boolean,
allowPromoteGuestToModerator: Boolean,
allowModsToUnmuteUsers: Boolean, allowModsToUnmuteUsers: Boolean,
allowModsToEjectCameras: Boolean, allowModsToEjectCameras: Boolean,
meetingLayout: String, meetingLayout: String,

View File

@ -401,6 +401,7 @@ const getUsersProp = () => {
'usersProp.allowModsToUnmuteUsers': 1, 'usersProp.allowModsToUnmuteUsers': 1,
'usersProp.allowModsToEjectCameras': 1, 'usersProp.allowModsToEjectCameras': 1,
'usersProp.authenticatedGuest': 1, 'usersProp.authenticatedGuest': 1,
'usersProp.allowPromoteGuestToModerator': 1,
}, },
}, },
); );
@ -411,6 +412,7 @@ const getUsersProp = () => {
allowModsToUnmuteUsers: false, allowModsToUnmuteUsers: false,
allowModsToEjectCameras: false, allowModsToEjectCameras: false,
authenticatedGuest: false, authenticatedGuest: false,
allowPromoteGuestToModerator: false,
}; };
}; };
@ -463,14 +465,18 @@ const getAvailableActions = (
&& !isSubjectUserModerator && !isSubjectUserModerator
&& !isDialInUser && !isDialInUser
&& !isBreakoutRoom && !isBreakoutRoom
&& !(isSubjectUserGuest && usersProp.authenticatedGuest); && !(isSubjectUserGuest
&& usersProp.authenticatedGuest
&& !usersProp.allowPromoteGuestToModerator);
const allowedToDemote = amIModerator const allowedToDemote = amIModerator
&& !amISubjectUser && !amISubjectUser
&& isSubjectUserModerator && isSubjectUserModerator
&& !isDialInUser && !isDialInUser
&& !isBreakoutRoom && !isBreakoutRoom
&& !(isSubjectUserGuest && usersProp.authenticatedGuest); && !(isSubjectUserGuest
&& usersProp.authenticatedGuest
&& !usersProp.allowPromoteGuestToModerator);
const allowedToChangeStatus = amISubjectUser && USER_STATUS_ENABLED; const allowedToChangeStatus = amISubjectUser && USER_STATUS_ENABLED;

View File

@ -160,6 +160,9 @@ defaultGuestPolicy=ALWAYS_ACCEPT
# Enables or disables authenticated guest # Enables or disables authenticated guest
authenticatedGuest=true authenticatedGuest=true
# Allows moderators to promote guests to moderators when authenticatedGuest is enabled
defaultAllowPromoteGuestToModerator=false
#--------------------------------------------------- #---------------------------------------------------
# Default Meeting Layout # Default Meeting Layout
# Valid values are CUSTOM_LAYOUT, SMART_LAYOUT, PRESENTATION_FOCUS, VIDEO_FOCUS # Valid values are CUSTOM_LAYOUT, SMART_LAYOUT, PRESENTATION_FOCUS, VIDEO_FOCUS

View File

@ -165,6 +165,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<property name="defaultAvatarURL" value="${defaultAvatarURL}"/> <property name="defaultAvatarURL" value="${defaultAvatarURL}"/>
<property name="defaultGuestPolicy" value="${defaultGuestPolicy}"/> <property name="defaultGuestPolicy" value="${defaultGuestPolicy}"/>
<property name="authenticatedGuest" value="${authenticatedGuest}"/> <property name="authenticatedGuest" value="${authenticatedGuest}"/>
<property name="defaultAllowPromoteGuestToModerator" value="${defaultAllowPromoteGuestToModerator}"/>
<property name="defaultMeetingLayout" value="${defaultMeetingLayout}"/> <property name="defaultMeetingLayout" value="${defaultMeetingLayout}"/>
<property name="meetingExpireIfNoUserJoinedInMinutes" value="${meetingExpireIfNoUserJoinedInMinutes}"/> <property name="meetingExpireIfNoUserJoinedInMinutes" value="${meetingExpireIfNoUserJoinedInMinutes}"/>
<property name="meetingExpireWhenLastUserLeftInMinutes" value="${meetingExpireWhenLastUserLeftInMinutes}"/> <property name="meetingExpireWhenLastUserLeftInMinutes" value="${meetingExpireWhenLastUserLeftInMinutes}"/>