Fix evaluate screen when user does not have view-users access. (#2771)

This commit is contained in:
Stan Silvert 2022-06-13 05:09:07 -04:00 committed by GitHub
parent f558052957
commit a0996cd91e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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<ResourceEvaluation, "context" | "resources"> {
@ -143,6 +145,10 @@ export const AuthorizationEvaluate = ({ client }: Props) => {
[evaluateResults, filter, searchQuery]
);
const { hasAccess } = useAccess();
if (!hasAccess("view-users"))
return <ForbiddenSection permissionNeeded="view-users" />;
useFetch(
() =>
Promise.all([