mirror of
https://github.com/portainer/portainer.git
synced 2025-08-10 16:25:22 +02:00
disable user list api call if not authorised
This commit is contained in:
parent
2dfa4a7c45
commit
2f4cf08f4c
2 changed files with 7 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue