diff options
| author | rr- <rr-@sakuya.pl> | 2016-05-08 16:59:25 +0200 |
|---|---|---|
| committer | rr- <rr-@sakuya.pl> | 2016-05-08 16:59:25 +0200 |
| commit | 198cb0af3e18bb8b526199d309d50df764e36552 (patch) | |
| tree | a7127d07d206ef8aa9ea5fc3d975fc4f8094c31d /client/js/api.js | |
| parent | 58964bcdc9cfeccd72a017fdbd2f4ffc8ba7b6f3 (diff) | |
server/users: hardcode available ranks
Diffstat (limited to 'client/js/api.js')
| -rw-r--r-- | client/js/api.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/client/js/api.js b/client/js/api.js index cb16608..515e2b4 100644 --- a/client/js/api.js +++ b/client/js/api.js @@ -11,6 +11,15 @@ class Api { this.userName = null; this.userPassword = null; this.cache = {}; + this.allRanks = [ + 'anonymous', + 'restricted', + 'regular', + 'power', + 'moderator', + 'administrator', + 'nobody', + ]; } get(url) { @@ -75,7 +84,7 @@ class Api { continue; } const rankName = config.privileges[privilege]; - const rankIndex = config.ranks.indexOf(rankName); + const rankIndex = this.allRanks.indexOf(rankName); if (minViableRank === null || rankIndex < minViableRank) { minViableRank = rankIndex; } @@ -84,7 +93,7 @@ class Api { console.error('Bad privilege name: ' + lookup); } let myRank = this.user !== null ? - config.ranks.indexOf(this.user.rank) : + this.allRanks.indexOf(this.user.rank) : 0; return myRank >= minViableRank; } |