diff --git a/awx/ui_next/src/screens/User/UserList/UserListItem.jsx b/awx/ui_next/src/screens/User/UserList/UserListItem.jsx
index 19b8b5b476..b772a47566 100644
--- a/awx/ui_next/src/screens/User/UserList/UserListItem.jsx
+++ b/awx/ui_next/src/screens/User/UserList/UserListItem.jsx
@@ -19,72 +19,89 @@ import DataListCell from '../../../components/DataListCell';
import { User } from '../../../types';
-class UserListItem extends React.Component {
- static propTypes = {
- user: User.isRequired,
- detailUrl: string.isRequired,
- isSelected: bool.isRequired,
- onSelect: func.isRequired,
- };
+function UserListItem({ user, isSelected, onSelect, detailUrl, i18n }) {
+ const labelId = `check-action-${user.id}`;
- render() {
- const { user, isSelected, onSelect, detailUrl, i18n } = this.props;
- const labelId = `check-action-${user.id}`;
- return (
-
-
-
-
-
- {user.username}
-
- ,
-
- {user.first_name && (
-
- {i18n._(t`First Name`)}
- {user.first_name}
-
- )}
- ,
-
- {user.last_name && (
-
- {i18n._(t`Last Name`)}
- {user.last_name}
-
- )}
- ,
- ]}
- />
-
- {user.summary_fields.user_capabilities.edit && (
-
-
-
- )}
-
-
-
- );
+ let user_type;
+ if (user.is_superuser) {
+ user_type = i18n._(t`System Administrator`);
+ } else if (user.is_system_auditor) {
+ user_type = i18n._(t`System Auditor`);
+ } else {
+ user_type = i18n._(t`Normal User`);
}
+
+ return (
+
+
+
+
+
+ {user.username}
+
+ ,
+
+ {user.first_name && (
+
+ {i18n._(t`First Name`)}
+ {user.first_name}
+
+ )}
+ ,
+
+ {user.last_name && (
+
+ {i18n._(t`Last Name`)}
+ {user.last_name}
+
+ )}
+ ,
+
+ {user_type}
+ ,
+ ]}
+ />
+
+ {user.summary_fields.user_capabilities.edit && (
+
+
+
+ )}
+
+
+
+ );
}
+
+UserListItem.prototype = {
+ user: User.isRequired,
+ detailUrl: string.isRequired,
+ isSelected: bool.isRequired,
+ onSelect: func.isRequired,
+};
+
export default withI18n()(UserListItem);
diff --git a/awx/ui_next/src/screens/User/UserList/UserListItem.test.jsx b/awx/ui_next/src/screens/User/UserList/UserListItem.test.jsx
index acdc7eecc0..e11b6da00c 100644
--- a/awx/ui_next/src/screens/User/UserList/UserListItem.test.jsx
+++ b/awx/ui_next/src/screens/User/UserList/UserListItem.test.jsx
@@ -28,12 +28,18 @@ describe('UserListItem with full permissions', () => {
);
});
- test('initially renders succesfully', () => {
+ test('initially renders successfully', () => {
expect(wrapper.length).toBe(1);
});
test('edit button shown to users with edit capabilities', () => {
expect(wrapper.find('PencilAltIcon').exists()).toBeTruthy();
});
+
+ test('should display user type', () => {
+ expect(
+ wrapper.find('DataListCell[aria-label="user type"]').prop('children')
+ ).toEqual('System Administrator');
+ });
});
describe('UserListItem without full permissions', () => {