mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Fleet UI: Remove hosts pack information from observers and observer plus (#11141)
This commit is contained in:
parent
43cbadd7dc
commit
45174aa258
2 changed files with 24 additions and 2 deletions
1
changes/11074-hide-hosts-packs-info-from-observers
Normal file
1
changes/11074-hide-hosts-packs-info-from-observers
Normal file
|
|
@ -0,0 +1 @@
|
|||
- UI: Remove any host's packs information for observers and observer plus
|
||||
|
|
@ -40,6 +40,7 @@ import {
|
|||
humanHostDiskEncryptionEnabled,
|
||||
wrapFleetHelper,
|
||||
} from "utilities/helpers";
|
||||
import permissions from "utilities/permissions";
|
||||
|
||||
import HostSummaryCard from "../cards/HostSummary";
|
||||
import AboutCard from "../cards/About";
|
||||
|
|
@ -107,10 +108,11 @@ const HostDetailsPage = ({
|
|||
const hostIdFromURL = parseInt(host_id, 10);
|
||||
const {
|
||||
config,
|
||||
currentUser,
|
||||
isGlobalAdmin = false,
|
||||
isGlobalObserver,
|
||||
isPremiumTier = false,
|
||||
isOnlyObserver,
|
||||
isObserverPlus,
|
||||
filteredHostsPath,
|
||||
} = useContext(AppContext);
|
||||
const {
|
||||
|
|
@ -606,6 +608,23 @@ const HostDetailsPage = ({
|
|||
host?.mdm.name === "Fleet" &&
|
||||
host?.mdm.macos_settings.disk_encryption === "action_required";
|
||||
|
||||
/* Context team id might be different that host's team id
|
||||
Observer plus must be checked against host's team id */
|
||||
const isGlobalOrHostsTeamObserverPlus =
|
||||
currentUser && host?.team_id
|
||||
? permissions.isObserverPlus(currentUser, host.team_id)
|
||||
: false;
|
||||
|
||||
const isHostsTeamObserver =
|
||||
currentUser && host?.team_id
|
||||
? permissions.isTeamObserver(currentUser, host.team_id)
|
||||
: false;
|
||||
|
||||
const canViewPacks =
|
||||
!isGlobalObserver &&
|
||||
!isGlobalOrHostsTeamObserverPlus &&
|
||||
!isHostsTeamObserver;
|
||||
|
||||
return (
|
||||
<MainContent className={baseClass}>
|
||||
<div className={`${baseClass}__wrapper`}>
|
||||
|
|
@ -704,7 +723,9 @@ const HostDetailsPage = ({
|
|||
scheduleState={scheduleState}
|
||||
isLoading={isLoadingHost}
|
||||
/>
|
||||
<PacksCard packsState={packsState} isLoading={isLoadingHost} />
|
||||
{canViewPacks && (
|
||||
<PacksCard packsState={packsState} isLoading={isLoadingHost} />
|
||||
)}
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<PoliciesCard
|
||||
|
|
|
|||
Loading…
Reference in a new issue