Browse Source

feat(profile): Don't allow non-guest users to edit their profile

master
hristoterezov 8 years ago
parent
commit
f10b13328f
3 changed files with 10 additions and 2 deletions
  1. 5
    1
      config.js
  2. 3
    0
      modules/TokenData/TokenData.js
  3. 2
    1
      modules/UI/UI.js

+ 5
- 1
config.js View File

69
     'During that time service will not be available. ' +
69
     'During that time service will not be available. ' +
70
     'Apologise for inconvenience.',*/
70
     'Apologise for inconvenience.',*/
71
     disableThirdPartyRequests: false,
71
     disableThirdPartyRequests: false,
72
-    minHDHeight: 540
72
+    minHDHeight: 540,
73
+    // If true - all users without token will be considered guests and all users
74
+    // with token will be considered non-guests. Only guests will be allowed to
75
+    // edit their profile.
76
+    enableUserRolesBasedOnToken: false
73
 };
77
 };

+ 3
- 0
modules/TokenData/TokenData.js View File

65
      * @param {string} the JWT token
65
      * @param {string} the JWT token
66
      */
66
      */
67
     constructor(jwt) {
67
     constructor(jwt) {
68
+        this.isGuest = true;
68
         if(!jwt)
69
         if(!jwt)
69
             return;
70
             return;
70
 
71
 
72
+        this.isGuest = config.enableUserRolesBasedOnToken !== true;
73
+
71
         this.jwt = jwt;
74
         this.jwt = jwt;
72
 
75
 
73
         //External API settings
76
         //External API settings

+ 2
- 1
modules/UI/UI.js View File

367
     UI.addListener(UIEvents.TOGGLE_CONTACT_LIST, UI.toggleContactList);
367
     UI.addListener(UIEvents.TOGGLE_CONTACT_LIST, UI.toggleContactList);
368
 
368
 
369
     UI.addListener( UIEvents.TOGGLE_PROFILE, function() {
369
     UI.addListener( UIEvents.TOGGLE_PROFILE, function() {
370
-        UI.toggleSidePanel("profile_container");
370
+        if(APP.tokenData.isGuest)
371
+            UI.toggleSidePanel("profile_container");
371
     });
372
     });
372
 
373
 
373
     UI.addListener(UIEvents.TOGGLE_FILM_STRIP, UI.handleToggleFilmStrip);
374
     UI.addListener(UIEvents.TOGGLE_FILM_STRIP, UI.handleToggleFilmStrip);

Loading…
Cancel
Save