Fix evaluate screen when user does not have view-users access. (#2771)
This commit is contained in:
parent
f558052957
commit
a0996cd91e
1 changed files with 6 additions and 0 deletions
|
@ -41,6 +41,8 @@ import { AuthorizationEvaluateResource } from "./AuthorizationEvaluateResource";
|
||||||
import { SearchIcon } from "@patternfly/react-icons";
|
import { SearchIcon } from "@patternfly/react-icons";
|
||||||
import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState";
|
import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState";
|
||||||
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
|
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
|
||||||
|
import { useAccess } from "../../context/access/Access";
|
||||||
|
import { ForbiddenSection } from "../../ForbiddenSection";
|
||||||
|
|
||||||
interface EvaluateFormInputs
|
interface EvaluateFormInputs
|
||||||
extends Omit<ResourceEvaluation, "context" | "resources"> {
|
extends Omit<ResourceEvaluation, "context" | "resources"> {
|
||||||
|
@ -143,6 +145,10 @@ export const AuthorizationEvaluate = ({ client }: Props) => {
|
||||||
[evaluateResults, filter, searchQuery]
|
[evaluateResults, filter, searchQuery]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const { hasAccess } = useAccess();
|
||||||
|
if (!hasAccess("view-users"))
|
||||||
|
return <ForbiddenSection permissionNeeded="view-users" />;
|
||||||
|
|
||||||
useFetch(
|
useFetch(
|
||||||
() =>
|
() =>
|
||||||
Promise.all([
|
Promise.all([
|
||||||
|
|
Loading…
Reference in a new issue