From: Stephen Smith Date: Mon, 14 Mar 2022 21:13:34 +0000 (-0400) Subject: 18559: Hide profile admin tab to non-admins X-Git-Tag: 2.4.0~1^2~27 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/36b2ed3407e92cb7788a87eb52badd18eb7b2b18 18559: Hide profile admin tab to non-admins Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- diff --git a/src/views/user-profile-panel/user-profile-panel-root.tsx b/src/views/user-profile-panel/user-profile-panel-root.tsx index 2176b323..d42fb6e1 100644 --- a/src/views/user-profile-panel/user-profile-panel-root.tsx +++ b/src/views/user-profile-panel/user-profile-panel-root.tsx @@ -103,6 +103,13 @@ export enum UserProfileGroupsColumnNames { REMOVE = "Remove", } +enum TABS { + PROFILE = "PROFILE", + GROUPS = "GROUPS", + ADMIN = "ADMIN", + +} + export const userProfileGroupsColumns: DataColumns = [ { name: UserProfileGroupsColumnNames.NAME, @@ -157,21 +164,21 @@ const ReadOnlyField = withStyles(styles)( export const UserProfilePanelRoot = withStyles(styles)( class extends React.Component { state = { - value: 0, + value: TABS.PROFILE, }; componentDidMount() { - this.setState({ value: 0 }); + this.setState({ value: TABS.PROFILE}); } render() { return - - - + + + {this.props.isAdmin && } - {this.state.value === 0 && + {this.state.value === TABS.PROFILE &&
@@ -259,7 +266,7 @@ export const UserProfilePanelRoot = withStyles(styles)(
} - {this.state.value === 1 && + {this.state.value === TABS.GROUPS &&
} />
} - {this.state.value === 2 && + {this.props.isAdmin && this.state.value === TABS.ADMIN &&