From 99625cd35f57c663c03ae843adaeaaf3e8e20473 Mon Sep 17 00:00:00 2001 From: Prabhat Khera <91852476+prabhat-org@users.noreply.github.com> Date: Thu, 28 Sep 2023 12:40:54 +1300 Subject: [PATCH] fix team lead access to view user names (#10388) --- .../AccessControlPanel/AccessControlPanel.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/react/portainer/access-control/AccessControlPanel/AccessControlPanel.tsx b/app/react/portainer/access-control/AccessControlPanel/AccessControlPanel.tsx index 4109c6a5d..315179b68 100644 --- a/app/react/portainer/access-control/AccessControlPanel/AccessControlPanel.tsx +++ b/app/react/portainer/access-control/AccessControlPanel/AccessControlPanel.tsx @@ -4,7 +4,7 @@ import { Edit, Eye } from 'lucide-react'; import { useUser } from '@/react/hooks/useUser'; import { Icon } from '@/react/components/Icon'; import { TeamMembership, TeamRole } from '@/react/portainer/users/teams/types'; -import { useUserMembership } from '@/portainer/users/queries'; +import { useIsTeamLeader, useUserMembership } from '@/portainer/users/queries'; import { EnvironmentId } from '@/react/portainer/environments/types'; import { TableContainer, TableTitle } from '@@/datatables'; @@ -34,7 +34,7 @@ export function AccessControlPanel({ onUpdateSuccess, }: Props) { const [isEditMode, toggleEditMode] = useReducer((state) => !state, false); - const { isAdmin } = useUser(); + const { user, isAdmin } = useUser(); const isInherited = checkIfInherited(); @@ -46,13 +46,15 @@ export function AccessControlPanel({ isInherited || (!isAdmin && !isPartOfRestrictedUsers && !isLeaderOfAnyRestrictedTeams); + const isTeamLeader = useIsTeamLeader(user) as boolean; + return ( {!isEditDisabled && !isEditMode && (