diff --git a/src/components/InventoryDetail/DetailRenderer.js b/src/components/InventoryDetail/DetailRenderer.js
index 5d28b5395..d9a718ecb 100644
--- a/src/components/InventoryDetail/DetailRenderer.js
+++ b/src/components/InventoryDetail/DetailRenderer.js
@@ -4,19 +4,17 @@ import PropTypes from 'prop-types';
import React, { useEffect, useState } from 'react';
import AccessDenied from '../../Utilities/AccessDenied';
import { hosts } from '../../api';
-import {
- GENERAL_HOSTS_READ_PERMISSIONS,
- REQUIRED_PERMISSIONS_TO_READ_GROUP_HOSTS,
-} from '../../constants';
+import { REQUIRED_PERMISSIONS_TO_READ_GROUP_HOSTS } from '../../constants';
import DetailWrapper from './DetailWrapper';
const DetailRenderer = ({ isRbacEnabled, ...props }) => {
const [hostGroupId, setHostGroupId] = useState(null);
const [isLoading, setIsLoading] = useState(true);
const { hasAccess } = usePermissionsWithContext(
- hostGroupId !== null
- ? REQUIRED_PERMISSIONS_TO_READ_GROUP_HOSTS(hostGroupId)
- : [GENERAL_HOSTS_READ_PERMISSIONS]
+ /**
+ * hostGroupId can be null, and the ungrouped hosts permissions will be checked in that case
+ */
+ REQUIRED_PERMISSIONS_TO_READ_GROUP_HOSTS(hostGroupId)
);
useEffect(() => {
@@ -51,11 +49,10 @@ const DetailRenderer = ({ isRbacEnabled, ...props }) => {
};
}, [props.inventoryId]);
- if (isRbacEnabled === false) {
- return ;
- }
-
- if (isLoading) {
+ if (isLoading === true) {
+ /**
+ * TODO: test different scenarios once RTL migration is complete
+ */
return (
@@ -63,12 +60,16 @@ const DetailRenderer = ({ isRbacEnabled, ...props }) => {
);
- }
-
- if (hasAccess === false) {
- return ;
} else {
- return ;
+ if (isRbacEnabled === true) {
+ if (hasAccess === false) {
+ return ;
+ } else {
+ return ;
+ }
+ } else {
+ return ;
+ }
}
};
diff --git a/src/components/InventoryDetail/DetailWrapper.js b/src/components/InventoryDetail/DetailWrapper.js
index dbef3f460..e2782c6e3 100644
--- a/src/components/InventoryDetail/DetailWrapper.js
+++ b/src/components/InventoryDetail/DetailWrapper.js
@@ -23,7 +23,6 @@ const DetailWrapper = ({
showTags,
Wrapper,
className,
- hasAccess,
appName,
inventoryId,
...props
@@ -96,7 +95,6 @@ DetailWrapper.propTypes = {
]),
className: PropTypes.string,
Wrapper: PropTypes.elementType,
- hasAccess: PropTypes.bool,
inventoryId: PropTypes.string.isRequired,
};