Przeglądaj źródła

feat: Drop enableUserRolesBasedOnToken and isGuest.

master
damencho 5 lat temu
rodzic
commit
0934fffa25

+ 0
- 5
config.js Wyświetl plik

@@ -362,11 +362,6 @@ var config = {
362 362
     // Disables profile and the edit of all fields from the profile settings (display name and email)
363 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 365
     // Whether or not some features are checked based on token.
371 366
     // enableFeaturesBasedOnToken: false,
372 367
 

+ 2
- 2
react/features/app/actions.js Wyświetl plik

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

+ 1
- 10
react/features/base/jwt/middleware.js Wyświetl plik

@@ -29,10 +29,7 @@ MiddlewareRegistry.register(store => next => action => {
29 29
     case SET_CONFIG:
30 30
     case SET_LOCATION_URL:
31 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 33
         return _setConfigOrLocationURL(store, next, action);
37 34
 
38 35
     case SET_JWT:
@@ -128,12 +125,6 @@ function _setJWT(store, next, action) {
128 125
 
129 126
     if (!Object.keys(actionPayload).length) {
130 127
         if (jwt) {
131
-            const {
132
-                enableUserRolesBasedOnToken
133
-            } = store.getState()['features/base/config'];
134
-
135
-            action.isGuest = !enableUserRolesBasedOnToken;
136
-
137 128
             let jwtPayload;
138 129
 
139 130
             try {

+ 1
- 20
react/features/base/jwt/reducer.js Wyświetl plik

@@ -4,24 +4,6 @@ import { equals, ReducerRegistry } from '../redux';
4 4
 
5 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 8
  * Reduces redux actions which affect the JSON Web Token (JWT) stored in the
27 9
  * redux store.
@@ -33,13 +15,12 @@ const DEFAULT_STATE = {
33 15
  */
34 16
 ReducerRegistry.register(
35 17
     'features/base/jwt',
36
-    (state = DEFAULT_STATE, action) => {
18
+    (state = {}, action) => {
37 19
         switch (action.type) {
38 20
         case SET_JWT: {
39 21
             // eslint-disable-next-line no-unused-vars
40 22
             const { type, ...payload } = action;
41 23
             const nextState = {
42
-                ...DEFAULT_STATE,
43 24
                 ...payload
44 25
             };
45 26
 

+ 1
- 4
react/features/base/participants/functions.js Wyświetl plik

@@ -308,10 +308,7 @@ export function isLocalParticipantModerator(stateful: Object | Function) {
308 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 Wyświetl plik

@@ -352,7 +352,7 @@ export function invitePeopleAndChatRooms( // eslint-disable-line max-params
352 352
 export function isAddPeopleEnabled(state: Object): boolean {
353 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,16 +368,6 @@ export function isDialOutEnabled(state: Object): boolean {
368 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 372
  * Checks whether a string looks like it could be for a phone number.
383 373
  *

Ładowanie…
Anuluj
Zapisz