Add option to allow guest(moderators) to add a room password

This commit is contained in:
Дамян Минков 2019-05-09 12:30:38 +01:00 committed by Saúl Ibarra Corretgé
parent 103ae363f6
commit f5ac18da18
3 changed files with 10 additions and 3 deletions

View File

@ -266,6 +266,9 @@ var config = {
// Whether or not some features are checked based on token.
// enableFeaturesBasedOnToken: false,
// Enable lock room for all moderators, even when userRolesBasedOnToken is enabled and participants are guests.
// lockRoomGuestEnabled: false,
// Message to show the users. Example: 'The service will be down for
// maintenance at 01:00 AM GMT,
// noticeMessage: '',

View File

@ -266,9 +266,12 @@ function _getAllParticipants(stateful) {
*
* @param {Object|Function} stateful - Object or function that can be resolved
* to the Redux state.
* @param {?boolean} ignoreToken - When true we ignore the token check.
* @returns {boolean}
*/
export function isLocalParticipantModerator(stateful: Object | Function) {
export function isLocalParticipantModerator(
stateful: Object | Function,
ignoreToken: ?boolean = false) {
const state = toState(stateful);
const localParticipant = getLocalParticipant(state);
@ -278,7 +281,8 @@ export function isLocalParticipantModerator(stateful: Object | Function) {
return (
localParticipant.role === PARTICIPANT_ROLE.MODERATOR
&& (!state['features/base/config'].enableUserRolesBasedOnToken
&& (ignoreToken
|| !state['features/base/config'].enableUserRolesBasedOnToken
|| !state['features/base/jwt'].isGuest));
}

View File

@ -588,7 +588,7 @@ function _mapStateToProps(state) {
} = state['features/base/conference'];
return {
_canEditPassword: isLocalParticipantModerator(state),
_canEditPassword: isLocalParticipantModerator(state, state['features/base/config'].lockRoomGuestEnabled),
_conference: conference,
_conferenceName: room,
_inviteURL: getInviteURL(state),