From 1e7985a87a72bea9a308cf1506dacc828c6e2e1c Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Tue, 13 Sep 2016 12:42:48 -0400
Subject: Modifying permissions system. (#3897)

---
 webapp/components/team_members_dropdown.jsx | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'webapp/components/team_members_dropdown.jsx')

diff --git a/webapp/components/team_members_dropdown.jsx b/webapp/components/team_members_dropdown.jsx
index 527161103..6b9390ade 100644
--- a/webapp/components/team_members_dropdown.jsx
+++ b/webapp/components/team_members_dropdown.jsx
@@ -37,12 +37,12 @@ export default class TeamMembersDropdown extends React.Component {
     handleMakeMember() {
         const me = UserStore.getCurrentUser();
         if (this.props.user.id === me.id) {
-            this.handleDemote(this.props.user, '');
+            this.handleDemote(this.props.user, 'team_user');
         } else {
             Client.updateRoles(
                 this.props.teamMember.team_id,
                 this.props.user.id,
-                '',
+                'team_user',
                 () => {
                     AsyncClient.getTeamMembers(TeamStore.getCurrentId());
                     AsyncClient.getProfiles();
@@ -93,12 +93,12 @@ export default class TeamMembersDropdown extends React.Component {
     handleMakeAdmin() {
         const me = UserStore.getCurrentUser();
         if (this.props.user.id === me.id) {
-            this.handleDemote(this.props.user, 'admin');
+            this.handleDemote(this.props.user, 'team_user team_admin');
         } else {
             Client.updateRoles(
                 this.props.teamMember.team_id,
                 this.props.user.id,
-                'admin',
+                'team_user team_admin',
                 () => {
                     AsyncClient.getTeamMembers(TeamStore.getCurrentId());
                     AsyncClient.getProfiles();
@@ -186,10 +186,10 @@ export default class TeamMembersDropdown extends React.Component {
         }
 
         const me = UserStore.getCurrentUser();
-        let showMakeMember = teamMember.roles === 'admin' && user.roles !== 'system_admin';
-        let showMakeAdmin = teamMember.roles === '' && user.roles !== 'system_admin';
+        let showMakeMember = Utils.isAdmin(teamMember.roles) && !Utils.isSystemAdmin(user.roles);
+        let showMakeAdmin = !Utils.isAdmin(teamMember.roles) && !Utils.isSystemAdmin(user.roles);
         let showMakeActive = false;
-        let showMakeNotActive = user.roles !== 'system_admin';
+        let showMakeNotActive = Utils.isSystemAdmin(user.roles);
 
         if (user.delete_at > 0) {
             currentRoles = (
-- 
cgit v1.2.3-1-g7c22

