derive admin flag from roles

This commit is contained in:
Girish Ramakrishnan
2020-02-21 16:52:37 -08:00
parent 6f12cde2e8
commit 7061880104
2 changed files with 10 additions and 3 deletions

View File

@@ -58,6 +58,13 @@ var ERROR = {
UNKNOWN_ERROR: 'Unknown Error' // only used for portin,
};
var ROLES = {
OWNER: 'owner',
ADMIN: 'admin',
USER_MANAGER: 'usermanager',
USER: 'user'
};
angular.module('Application').service('Client', ['$http', '$interval', '$timeout', 'md5', 'Notification', function ($http, $interval, $timeout, md5, Notification) {
var client = null;
@@ -326,7 +333,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
this._userInfo.fallbackEmail = userInfo.fallbackEmail;
this._userInfo.displayName = userInfo.displayName;
this._userInfo.twoFactorAuthenticationEnabled = userInfo.twoFactorAuthenticationEnabled;
this._userInfo.admin = userInfo.admin;
this._userInfo.admin = userInfo.role === ROLES.OWNER || ROLES.ADMIN;
this._userInfo.source = userInfo.source;
this._userInfo.avatarUrl = userInfo.avatarUrl + '?s=128&default=mp&ts=' + Date.now(); // we add the timestamp to avoid caching
};