disable user list api call if not authorised

fix/EE-4602/switch-color-fix-rel-new
Prabhat Khera 1 year ago
parent fa087f0bb9
commit ad95bac5cc

@ -52,6 +52,7 @@ export function AccessControlPanel({
<AccessControlPanelDetails
resourceType={resourceType}
resourceControl={resourceControl}
isAuthorisedToFetchUsers={isAdmin || isLeaderOfAnyRestrictedTeams}
/>
{!isEditDisabled && !isEditMode && (

@ -24,11 +24,13 @@ import { ResourceControlViewModel } from '../models/ResourceControlViewModel';
interface Props {
resourceControl?: ResourceControlViewModel;
resourceType: ResourceControlType;
isAuthorisedToFetchUsers?: boolean;
}
export function AccessControlPanelDetails({
resourceControl,
resourceType,
isAuthorisedToFetchUsers = false,
}: Props) {
const inheritanceMessage = getInheritanceMessage(
resourceType,
@ -41,7 +43,10 @@ export function AccessControlPanelDetails({
TeamAccesses: restrictedToTeams = [],
} = resourceControl || {};
const users = useAuthorizedUsers(restrictedToUsers.map((ra) => ra.UserId));
const users = useAuthorizedUsers(
restrictedToUsers.map((ra) => ra.UserId),
isAuthorisedToFetchUsers
);
const teams = useAuthorizedTeams(restrictedToTeams.map((ra) => ra.TeamId));
const teamsLength = teams.data ? teams.data.length : 0;

Loading…
Cancel
Save