diff --git a/src/js/client.js b/src/js/client.js index f28858d56..8999d54cf 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -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 }; diff --git a/src/views/users.js b/src/views/users.js index b14324ec4..f0c5cede6 100644 --- a/src/views/users.js +++ b/src/views/users.js @@ -26,8 +26,8 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio $scope.userInfo = Client.getUserInfo(); $scope.roles = [ - { id: '', name: 'User' }, - { id: 'manage_users', name: 'User Manager' }, + { id: 'user', name: 'User' }, + { id: 'usermanager', name: 'User Manager' }, { id: 'admin', name: 'Administrator' }, { id: 'owner', name: 'Owner' } ];