Browse Source

feat: Drop enableUserRolesBasedOnToken and isGuest.

master
damencho 5 years ago
parent
commit
0934fffa25

+ 0
- 5
config.js View File

362
     // Disables profile and the edit of all fields from the profile settings (display name and email)
362
     // Disables profile and the edit of all fields from the profile settings (display name and email)
363
     // disableProfile: false,
363
     // disableProfile: false,
364
 
364
 
365
-    // If true all users without a token will be considered guests and all users
366
-    // with token will be considered non-guests. Only guests will be allowed to
367
-    // edit their profile.
368
-    enableUserRolesBasedOnToken: false,
369
-
370
     // Whether or not some features are checked based on token.
365
     // Whether or not some features are checked based on token.
371
     // enableFeaturesBasedOnToken: false,
366
     // enableFeaturesBasedOnToken: false,
372
 
367
 

+ 2
- 2
react/features/app/actions.js View File

298
                 return;
298
                 return;
299
             }
299
             }
300
 
300
 
301
-            const { isGuest, jwt } = getState()['features/base/jwt'];
301
+            const { jwt } = getState()['features/base/jwt'];
302
 
302
 
303
             let hashParam;
303
             let hashParam;
304
 
304
 
305
             // save whether current user is guest or not, and pass auth token,
305
             // save whether current user is guest or not, and pass auth token,
306
             // before navigating to close page
306
             // before navigating to close page
307
-            window.sessionStorage.setItem('guest', isGuest);
307
+            window.sessionStorage.setItem('guest', !jwt);
308
             window.sessionStorage.setItem('jwt', jwt);
308
             window.sessionStorage.setItem('jwt', jwt);
309
 
309
 
310
             let path = 'close.html';
310
             let path = 'close.html';

+ 1
- 10
react/features/base/jwt/middleware.js View File

29
     case SET_CONFIG:
29
     case SET_CONFIG:
30
     case SET_LOCATION_URL:
30
     case SET_LOCATION_URL:
31
         // XXX The JSON Web Token (JWT) is not the only piece of state that we
31
         // XXX The JSON Web Token (JWT) is not the only piece of state that we
32
-        // have decided to store in the feature jwt, there is isGuest as well
33
-        // which depends on the states of the features base/config and jwt. So
34
-        // the JSON Web Token comes from the conference/room's URL and isGuest
35
-        // needs a recalculation upon SET_CONFIG as well.
32
+        // have decided to store in the feature jwt
36
         return _setConfigOrLocationURL(store, next, action);
33
         return _setConfigOrLocationURL(store, next, action);
37
 
34
 
38
     case SET_JWT:
35
     case SET_JWT:
128
 
125
 
129
     if (!Object.keys(actionPayload).length) {
126
     if (!Object.keys(actionPayload).length) {
130
         if (jwt) {
127
         if (jwt) {
131
-            const {
132
-                enableUserRolesBasedOnToken
133
-            } = store.getState()['features/base/config'];
134
-
135
-            action.isGuest = !enableUserRolesBasedOnToken;
136
-
137
             let jwtPayload;
128
             let jwtPayload;
138
 
129
 
139
             try {
130
             try {

+ 1
- 20
react/features/base/jwt/reducer.js View File

4
 
4
 
5
 import { SET_JWT } from './actionTypes';
5
 import { SET_JWT } from './actionTypes';
6
 
6
 
7
-/**
8
- * The default/initial redux state of the feature jwt.
9
- *
10
- * @private
11
- * @type {{
12
- *     isGuest: boolean
13
- * }}
14
- */
15
-const DEFAULT_STATE = {
16
-    /**
17
-     * The indicator which determines whether the local participant is a guest
18
-     * in the conference.
19
-     *
20
-     * @type {boolean}
21
-     */
22
-    isGuest: true
23
-};
24
-
25
 /**
7
 /**
26
  * Reduces redux actions which affect the JSON Web Token (JWT) stored in the
8
  * Reduces redux actions which affect the JSON Web Token (JWT) stored in the
27
  * redux store.
9
  * redux store.
33
  */
15
  */
34
 ReducerRegistry.register(
16
 ReducerRegistry.register(
35
     'features/base/jwt',
17
     'features/base/jwt',
36
-    (state = DEFAULT_STATE, action) => {
18
+    (state = {}, action) => {
37
         switch (action.type) {
19
         switch (action.type) {
38
         case SET_JWT: {
20
         case SET_JWT: {
39
             // eslint-disable-next-line no-unused-vars
21
             // eslint-disable-next-line no-unused-vars
40
             const { type, ...payload } = action;
22
             const { type, ...payload } = action;
41
             const nextState = {
23
             const nextState = {
42
-                ...DEFAULT_STATE,
43
                 ...payload
24
                 ...payload
44
             };
25
             };
45
 
26
 

+ 1
- 4
react/features/base/participants/functions.js View File

308
         return false;
308
         return false;
309
     }
309
     }
310
 
310
 
311
-    return (
312
-        localParticipant.role === PARTICIPANT_ROLE.MODERATOR
313
-        && (!state['features/base/config'].enableUserRolesBasedOnToken
314
-            || !state['features/base/jwt'].isGuest));
311
+    return localParticipant.role === PARTICIPANT_ROLE.MODERATOR;
315
 }
312
 }
316
 
313
 
317
 /**
314
 /**

+ 1
- 11
react/features/invite/functions.js View File

352
 export function isAddPeopleEnabled(state: Object): boolean {
352
 export function isAddPeopleEnabled(state: Object): boolean {
353
     const { peopleSearchUrl } = state['features/base/config'];
353
     const { peopleSearchUrl } = state['features/base/config'];
354
 
354
 
355
-    return !isGuest(state) && Boolean(peopleSearchUrl);
355
+    return state['features/base/jwt'].jwt && Boolean(peopleSearchUrl);
356
 }
356
 }
357
 
357
 
358
 /**
358
 /**
368
         && conference && conference.isSIPCallingSupported();
368
         && conference && conference.isSIPCallingSupported();
369
 }
369
 }
370
 
370
 
371
-/**
372
- * Determines if the current user is guest or not.
373
- *
374
- * @param {Object} state - Current state.
375
- * @returns {boolean}
376
- */
377
-export function isGuest(state: Object): boolean {
378
-    return state['features/base/jwt'].isGuest;
379
-}
380
-
381
 /**
371
 /**
382
  * Checks whether a string looks like it could be for a phone number.
372
  * Checks whether a string looks like it could be for a phone number.
383
  *
373
  *

Loading…
Cancel
Save