Render SuperAdmin column in Chronograf Admin Table based on Authorization

pull/10616/head
Alex P 2017-11-01 16:32:01 -07:00
parent dafaed6531
commit b432a12edd
2 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,7 @@
import React, {PropTypes} from 'react' import React, {PropTypes} from 'react'
import Authorized, {SUPERADMIN_ROLE} from 'src/auth/Authorized'
import Dropdown from 'shared/components/Dropdown' import Dropdown from 'shared/components/Dropdown'
import { import {
@ -79,9 +81,11 @@ const OrgTableRow = ({
: 'N/A'} : 'N/A'}
</span> </span>
</td> </td>
<td style={{width: colSuperAdmin}}> <Authorized requiredRole={SUPERADMIN_ROLE}>
{user.superadmin ? 'Yes' : '--'} <td style={{width: colSuperAdmin}}>
</td> {user.superadmin ? 'Yes' : '--'}
</td>
</Authorized>
<td style={{width: colProvider}}> <td style={{width: colProvider}}>
{user.provider} {user.provider}
</td> </td>

View File

@ -2,6 +2,8 @@ import React, {Component, PropTypes} from 'react'
import _ from 'lodash' import _ from 'lodash'
import Authorized, {SUPERADMIN_ROLE} from 'src/auth/Authorized'
import UsersTableRow from 'src/admin/components/chronograf/UsersTableRow' import UsersTableRow from 'src/admin/components/chronograf/UsersTableRow'
import OrgTableRow from 'src/admin/components/chronograf/OrgTableRow' import OrgTableRow from 'src/admin/components/chronograf/OrgTableRow'
@ -54,7 +56,9 @@ class ChronografUsersTable extends Component {
<th>Username</th> <th>Username</th>
<th style={{width: colOrg}}>Organization</th> <th style={{width: colOrg}}>Organization</th>
<th style={{width: colRole}}>Role</th> <th style={{width: colRole}}>Role</th>
<th style={{width: colSuperAdmin}}>SuperAdmin</th> <Authorized requiredRole={SUPERADMIN_ROLE}>
<th style={{width: colSuperAdmin}}>SuperAdmin</th>
</Authorized>
<th style={{width: colProvider}}>Provider</th> <th style={{width: colProvider}}>Provider</th>
<th className="text-right" style={{width: colScheme}}> <th className="text-right" style={{width: colScheme}}>
Scheme Scheme