Quellcode durchsuchen

fix(password): do not let guests edit password when roles are enabled

If config.enableUserRolesBasedOnToken is true, only let moderators
and non-guests modify the password. Otherwise, only let moderators
edit the password.
master
Leonard Kim vor 7 Jahren
Ursprung
Commit
2720c76e4d
1 geänderte Dateien mit 21 neuen und 12 gelöschten Zeilen
  1. 21
    12
      react/features/invite/components/InviteDialog.web.js

+ 21
- 12
react/features/invite/components/InviteDialog.web.js Datei anzeigen

@@ -27,6 +27,11 @@ class InviteDialog extends Component {
27 27
      * @static
28 28
      */
29 29
     static propTypes = {
30
+        /**
31
+         * Whether or not the current user can modify the current password.
32
+         */
33
+        _canEditPassword: PropTypes.bool,
34
+
30 35
         /**
31 36
          * The redux store representation of the JitsiConference.
32 37
          */
@@ -37,11 +42,6 @@ class InviteDialog extends Component {
37 42
          */
38 43
         _inviteURL: PropTypes.string,
39 44
 
40
-        /**
41
-         * Whether or not the current user is a conference moderator.
42
-         */
43
-        _isModerator: PropTypes.bool,
44
-
45 45
         /**
46 46
          * Invoked to obtain translated strings.
47 47
          */
@@ -64,7 +64,7 @@ class InviteDialog extends Component {
64 64
      * @returns {ReactElement}
65 65
      */
66 66
     render() {
67
-        const { _conference, _inviteURL, t } = this.props;
67
+        const { _canEditPassword, _conference, _inviteURL, t } = this.props;
68 68
         const titleString
69 69
             = t('invite.inviteTo', { conferenceName: _conference.room });
70 70
 
@@ -80,7 +80,7 @@ class InviteDialog extends Component {
80 80
                         conference = { _conference.conference }
81 81
                         locked = { _conference.locked }
82 82
                         password = { _conference.password }
83
-                        showPasswordEdit = { this.props._isModerator } />
83
+                        showPasswordEdit = { _canEditPassword } />
84 84
                 </div>
85 85
             </Dialog>
86 86
         );
@@ -94,17 +94,26 @@ class InviteDialog extends Component {
94 94
  * @param {Object} state - The Redux state.
95 95
  * @private
96 96
  * @returns {{
97
+ *     _canEditPassword: boolean,
97 98
  *     _conference: Object,
98
- *     _inviteURL: string,
99
- *     _isModerator: boolean
99
+ *     _inviteURL: string
100 100
  * }}
101 101
  */
102 102
 function _mapStateToProps(state) {
103
+    const isModerator
104
+        = getLocalParticipant(state).role === PARTICIPANT_ROLE.MODERATOR;
105
+    let canEditPassword;
106
+
107
+    if (state['features/base/config'].enableUserRolesBasedOnToken) {
108
+        canEditPassword = isModerator && !state['features/base/jwt'].isGuest;
109
+    } else {
110
+        canEditPassword = isModerator;
111
+    }
112
+
103 113
     return {
114
+        _canEditPassword: canEditPassword,
104 115
         _conference: state['features/base/conference'],
105
-        _inviteURL: getInviteURL(state),
106
-        _isModerator:
107
-            getLocalParticipant(state).role === PARTICIPANT_ROLE.MODERATOR
116
+        _inviteURL: getInviteURL(state)
108 117
     };
109 118
 }
110 119
 

Laden…
Abbrechen
Speichern