From f5ac18da18fe2b02b56f917d70cf325b4d76c849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Thu, 9 May 2019 12:30:38 +0100 Subject: [PATCH] Add option to allow guest(moderators) to add a room password --- config.js | 3 +++ react/features/base/participants/functions.js | 8 ++++++-- .../invite/components/info-dialog/web/InfoDialog.js | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/config.js b/config.js index d14d9cfd6..3589d3d23 100644 --- a/config.js +++ b/config.js @@ -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: '', diff --git a/react/features/base/participants/functions.js b/react/features/base/participants/functions.js index 025bb6bf3..1a73a75b8 100644 --- a/react/features/base/participants/functions.js +++ b/react/features/base/participants/functions.js @@ -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)); } diff --git a/react/features/invite/components/info-dialog/web/InfoDialog.js b/react/features/invite/components/info-dialog/web/InfoDialog.js index e005446ad..a1b5c886f 100644 --- a/react/features/invite/components/info-dialog/web/InfoDialog.js +++ b/react/features/invite/components/info-dialog/web/InfoDialog.js @@ -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),