From a0996cd91eef04b71211ce9203c0f513621890b6 Mon Sep 17 00:00:00 2001 From: Stan Silvert Date: Mon, 13 Jun 2022 05:09:07 -0400 Subject: [PATCH] Fix evaluate screen when user does not have view-users access. (#2771) --- src/clients/authorization/AuthorizationEvaluate.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/clients/authorization/AuthorizationEvaluate.tsx b/src/clients/authorization/AuthorizationEvaluate.tsx index 9fff1dedd8..e18ae3beac 100644 --- a/src/clients/authorization/AuthorizationEvaluate.tsx +++ b/src/clients/authorization/AuthorizationEvaluate.tsx @@ -41,6 +41,8 @@ import { AuthorizationEvaluateResource } from "./AuthorizationEvaluateResource"; import { SearchIcon } from "@patternfly/react-icons"; import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState"; import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput"; +import { useAccess } from "../../context/access/Access"; +import { ForbiddenSection } from "../../ForbiddenSection"; interface EvaluateFormInputs extends Omit { @@ -143,6 +145,10 @@ export const AuthorizationEvaluate = ({ client }: Props) => { [evaluateResults, filter, searchQuery] ); + const { hasAccess } = useAccess(); + if (!hasAccess("view-users")) + return ; + useFetch( () => Promise.all([