2023-05-03 13:51:02 +00:00
|
|
|
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
|
|
|
|
import type EvaluationResultRepresentation from "@keycloak/keycloak-admin-client/lib/defs/evaluationResultRepresentation";
|
|
|
|
import type PolicyEvaluationResponse from "@keycloak/keycloak-admin-client/lib/defs/policyEvaluationResponse";
|
|
|
|
import type ResourceEvaluation from "@keycloak/keycloak-admin-client/lib/defs/resourceEvaluation";
|
|
|
|
import type ResourceRepresentation from "@keycloak/keycloak-admin-client/lib/defs/resourceRepresentation";
|
|
|
|
import type RoleRepresentation from "@keycloak/keycloak-admin-client/lib/defs/roleRepresentation";
|
|
|
|
import type ScopeRepresentation from "@keycloak/keycloak-admin-client/lib/defs/scopeRepresentation";
|
2022-01-23 20:21:19 +00:00
|
|
|
import {
|
2022-12-02 14:54:30 +00:00
|
|
|
ActionGroup,
|
|
|
|
Button,
|
|
|
|
ExpandableSection,
|
2022-01-23 20:21:19 +00:00
|
|
|
FormGroup,
|
2022-12-02 14:54:30 +00:00
|
|
|
PageSection,
|
2023-05-24 12:11:06 +00:00
|
|
|
Panel,
|
|
|
|
PanelHeader,
|
|
|
|
PanelMainBody,
|
2022-01-23 20:21:19 +00:00
|
|
|
Select,
|
|
|
|
SelectOption,
|
2022-12-02 14:54:30 +00:00
|
|
|
SelectVariant,
|
2022-01-23 20:21:19 +00:00
|
|
|
Switch,
|
2023-05-24 12:11:06 +00:00
|
|
|
Title,
|
2022-01-23 20:21:19 +00:00
|
|
|
} from "@patternfly/react-core";
|
2022-12-02 14:54:30 +00:00
|
|
|
import { useState } from "react";
|
2023-03-02 12:50:29 +00:00
|
|
|
import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
|
2022-12-02 14:54:30 +00:00
|
|
|
import { useTranslation } from "react-i18next";
|
2023-05-03 13:51:02 +00:00
|
|
|
import { HelpItem } from "ui-shared";
|
2022-01-23 20:21:19 +00:00
|
|
|
|
2023-05-03 13:51:02 +00:00
|
|
|
import { ForbiddenSection } from "../../ForbiddenSection";
|
|
|
|
import { adminClient } from "../../admin-client";
|
|
|
|
import { useAlerts } from "../../components/alert/Alerts";
|
2023-01-26 09:31:07 +00:00
|
|
|
import { ClientSelect } from "../../components/client/ClientSelect";
|
2023-05-24 12:11:06 +00:00
|
|
|
import { FormAccess } from "../../components/form/FormAccess";
|
2023-02-20 14:49:50 +00:00
|
|
|
import {
|
|
|
|
KeyValueType,
|
2023-05-03 13:51:02 +00:00
|
|
|
keyValueToArray,
|
2023-02-20 14:49:50 +00:00
|
|
|
} from "../../components/key-value-form/key-value-convert";
|
2022-12-02 14:54:30 +00:00
|
|
|
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
|
|
|
|
import { UserSelect } from "../../components/users/UserSelect";
|
|
|
|
import { useAccess } from "../../context/access/Access";
|
2022-01-23 20:21:19 +00:00
|
|
|
import { useRealm } from "../../context/realm-context/RealmContext";
|
2023-05-03 15:40:27 +00:00
|
|
|
import { useFetch } from "../../utils/useFetch";
|
2022-12-02 14:54:30 +00:00
|
|
|
import { FormFields } from "../ClientDetails";
|
|
|
|
import { defaultContextAttributes } from "../utils";
|
|
|
|
import { KeyBasedAttributeInput } from "./KeyBasedAttributeInput";
|
2023-05-03 13:51:02 +00:00
|
|
|
import { Results } from "./evaluate/Results";
|
2022-06-13 10:13:36 +00:00
|
|
|
|
2022-02-15 17:52:46 +00:00
|
|
|
interface EvaluateFormInputs
|
|
|
|
extends Omit<ResourceEvaluation, "context" | "resources"> {
|
|
|
|
alias: string;
|
|
|
|
authScopes: string[];
|
|
|
|
context: {
|
|
|
|
attributes: Record<string, string>[];
|
|
|
|
};
|
2022-07-06 10:30:40 +00:00
|
|
|
resources?: Record<string, string>[];
|
2022-12-02 14:54:30 +00:00
|
|
|
client: FormFields;
|
2022-07-06 10:30:40 +00:00
|
|
|
user: string[];
|
2022-02-15 17:52:46 +00:00
|
|
|
}
|
2022-01-23 20:21:19 +00:00
|
|
|
|
|
|
|
export type AttributeType = {
|
|
|
|
key: string;
|
|
|
|
name: string;
|
|
|
|
custom?: boolean;
|
|
|
|
values?: {
|
|
|
|
[key: string]: string;
|
|
|
|
}[];
|
|
|
|
};
|
|
|
|
|
|
|
|
type ClientSettingsProps = {
|
2022-03-07 14:28:42 +00:00
|
|
|
client: ClientRepresentation;
|
2022-01-23 20:21:19 +00:00
|
|
|
save: () => void;
|
|
|
|
};
|
|
|
|
|
2022-02-15 17:52:46 +00:00
|
|
|
export type AttributeForm = Omit<
|
|
|
|
EvaluateFormInputs,
|
|
|
|
"context" | "resources"
|
|
|
|
> & {
|
|
|
|
context: {
|
|
|
|
attributes?: KeyValueType[];
|
|
|
|
};
|
|
|
|
resources?: KeyValueType[];
|
|
|
|
};
|
|
|
|
|
2022-02-17 16:03:18 +00:00
|
|
|
type Props = ClientSettingsProps & EvaluationResultRepresentation;
|
|
|
|
|
2023-06-01 09:56:06 +00:00
|
|
|
export const AuthorizationEvaluate = (props: Props) => {
|
|
|
|
const { hasAccess } = useAccess();
|
|
|
|
|
|
|
|
if (!hasAccess("view-users")) {
|
|
|
|
return <ForbiddenSection permissionNeeded="view-users" />;
|
|
|
|
}
|
|
|
|
|
|
|
|
return <AuthorizationEvaluateContent {...props} />;
|
|
|
|
};
|
|
|
|
|
|
|
|
const AuthorizationEvaluateContent = ({ client }: Props) => {
|
2022-07-06 10:30:40 +00:00
|
|
|
const form = useForm<EvaluateFormInputs>({ mode: "onChange" });
|
|
|
|
const {
|
|
|
|
control,
|
|
|
|
register,
|
|
|
|
reset,
|
|
|
|
trigger,
|
2022-12-02 14:54:30 +00:00
|
|
|
formState: { isValid, errors },
|
2022-07-06 10:30:40 +00:00
|
|
|
} = form;
|
2023-09-08 13:17:17 +00:00
|
|
|
const { t } = useTranslation();
|
2023-03-02 12:49:54 +00:00
|
|
|
const { addError } = useAlerts();
|
2022-01-23 20:21:19 +00:00
|
|
|
const realm = useRealm();
|
|
|
|
|
|
|
|
const [scopesDropdownOpen, setScopesDropdownOpen] = useState(false);
|
|
|
|
|
|
|
|
const [roleDropdownOpen, setRoleDropdownOpen] = useState(false);
|
|
|
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
|
|
const [applyToResourceType, setApplyToResourceType] = useState(false);
|
|
|
|
const [resources, setResources] = useState<ResourceRepresentation[]>([]);
|
|
|
|
const [scopes, setScopes] = useState<ScopeRepresentation[]>([]);
|
2022-07-06 10:30:40 +00:00
|
|
|
const [evaluateResult, setEvaluateResult] =
|
|
|
|
useState<PolicyEvaluationResponse>();
|
2022-02-17 16:03:18 +00:00
|
|
|
|
2022-03-07 14:28:42 +00:00
|
|
|
const [clientRoles, setClientRoles] = useState<RoleRepresentation[]>([]);
|
2022-03-11 10:19:20 +00:00
|
|
|
|
2022-03-07 14:28:42 +00:00
|
|
|
useFetch(
|
2022-07-06 10:30:40 +00:00
|
|
|
() => adminClient.roles.find(),
|
|
|
|
(roles) => {
|
2022-03-07 14:28:42 +00:00
|
|
|
setClientRoles(roles);
|
|
|
|
},
|
2023-07-11 14:03:21 +00:00
|
|
|
[],
|
2022-03-07 14:28:42 +00:00
|
|
|
);
|
|
|
|
|
2022-01-23 20:21:19 +00:00
|
|
|
useFetch(
|
2022-03-11 10:19:20 +00:00
|
|
|
() =>
|
2022-01-23 20:21:19 +00:00
|
|
|
Promise.all([
|
|
|
|
adminClient.clients.listResources({
|
2022-03-07 14:28:42 +00:00
|
|
|
id: client.id!,
|
2022-01-23 20:21:19 +00:00
|
|
|
}),
|
|
|
|
adminClient.clients.listAllScopes({
|
2022-03-07 14:28:42 +00:00
|
|
|
id: client.id!,
|
2022-01-23 20:21:19 +00:00
|
|
|
}),
|
|
|
|
]),
|
|
|
|
([resources, scopes]) => {
|
|
|
|
setResources(resources);
|
|
|
|
setScopes(scopes);
|
|
|
|
},
|
2023-07-11 14:03:21 +00:00
|
|
|
[],
|
2022-01-23 20:21:19 +00:00
|
|
|
);
|
|
|
|
|
2022-02-15 17:52:46 +00:00
|
|
|
const evaluate = async () => {
|
|
|
|
if (!(await trigger())) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const formValues = form.getValues();
|
2023-02-20 14:49:50 +00:00
|
|
|
const keys = keyValueToArray(formValues.resources as KeyValueType[]);
|
2022-01-23 20:21:19 +00:00
|
|
|
const resEval: ResourceEvaluation = {
|
|
|
|
roleIds: formValues.roleIds ?? [],
|
2022-03-07 14:28:42 +00:00
|
|
|
clientId: formValues.client.id!,
|
2023-03-02 12:49:54 +00:00
|
|
|
userId: formValues.user![0],
|
2023-02-20 14:49:50 +00:00
|
|
|
resources: resources
|
|
|
|
.filter((resource) => Object.keys(keys).includes(resource.name!))
|
|
|
|
.map((r) => ({
|
|
|
|
...r,
|
|
|
|
scopes: r.scopes?.filter((s) =>
|
|
|
|
Object.values(keys)
|
|
|
|
.flatMap((v) => v)
|
2023-07-11 14:03:21 +00:00
|
|
|
.includes(s.name!),
|
2023-02-20 14:49:50 +00:00
|
|
|
),
|
|
|
|
})),
|
2022-01-23 20:21:19 +00:00
|
|
|
entitlements: false,
|
2022-02-15 17:52:46 +00:00
|
|
|
context: {
|
|
|
|
attributes: Object.fromEntries(
|
|
|
|
formValues.context.attributes
|
|
|
|
.filter((item) => item.key || item.value !== "")
|
2023-07-11 14:03:21 +00:00
|
|
|
.map(({ key, value }) => [key, value]),
|
2022-02-15 17:52:46 +00:00
|
|
|
),
|
|
|
|
},
|
2022-01-23 20:21:19 +00:00
|
|
|
};
|
2022-02-15 17:52:46 +00:00
|
|
|
|
2023-03-02 12:49:54 +00:00
|
|
|
try {
|
|
|
|
const evaluation = await adminClient.clients.evaluateResource(
|
|
|
|
{ id: client.id!, realm: realm.realm },
|
2023-07-11 14:03:21 +00:00
|
|
|
resEval,
|
2023-03-02 12:49:54 +00:00
|
|
|
);
|
2022-02-17 16:03:18 +00:00
|
|
|
|
2023-03-02 12:49:54 +00:00
|
|
|
setEvaluateResult(evaluation);
|
|
|
|
} catch (error) {
|
2023-09-13 14:05:17 +00:00
|
|
|
addError("evaluateError", error);
|
2023-03-02 12:49:54 +00:00
|
|
|
}
|
2022-02-17 16:03:18 +00:00
|
|
|
};
|
|
|
|
|
2023-03-02 12:50:29 +00:00
|
|
|
const user = useWatch({ control, name: "user", defaultValue: [] });
|
|
|
|
const roles = useWatch({ control, name: "roleIds", defaultValue: [] });
|
|
|
|
|
2022-07-06 10:30:40 +00:00
|
|
|
if (evaluateResult) {
|
|
|
|
return (
|
|
|
|
<Results
|
|
|
|
evaluateResult={evaluateResult}
|
|
|
|
refresh={evaluate}
|
|
|
|
back={() => setEvaluateResult(undefined)}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2023-03-02 12:50:29 +00:00
|
|
|
|
2022-07-06 10:30:40 +00:00
|
|
|
return (
|
2022-01-23 20:21:19 +00:00
|
|
|
<PageSection>
|
2022-07-06 10:30:40 +00:00
|
|
|
<FormProvider {...form}>
|
2023-05-24 12:11:06 +00:00
|
|
|
<Panel>
|
|
|
|
<PanelHeader>
|
2023-09-13 14:05:17 +00:00
|
|
|
<Title headingLevel="h2">{t("identityInformation")}</Title>
|
2023-05-24 12:11:06 +00:00
|
|
|
</PanelHeader>
|
|
|
|
<PanelMainBody>
|
|
|
|
<FormAccess isHorizontal role="view-clients">
|
|
|
|
<ClientSelect
|
|
|
|
name="client"
|
|
|
|
label="client"
|
2023-09-13 14:05:17 +00:00
|
|
|
helpText={"clientHelp"}
|
2023-05-24 12:11:06 +00:00
|
|
|
defaultValue={client.clientId}
|
|
|
|
/>
|
|
|
|
<UserSelect
|
|
|
|
name="user"
|
|
|
|
label="users"
|
2023-09-13 14:05:17 +00:00
|
|
|
helpText={t("selectUser")}
|
2022-07-06 10:30:40 +00:00
|
|
|
defaultValue={[]}
|
2023-05-24 12:11:06 +00:00
|
|
|
variant={SelectVariant.typeahead}
|
|
|
|
isRequired={roles?.length === 0}
|
2022-07-06 10:30:40 +00:00
|
|
|
/>
|
2023-05-24 12:11:06 +00:00
|
|
|
<FormGroup
|
|
|
|
label={t("roles")}
|
|
|
|
labelIcon={
|
2023-09-13 14:05:17 +00:00
|
|
|
<HelpItem helpText={t("rolesHelp")} fieldLabelId="roles" />
|
2023-05-24 12:11:06 +00:00
|
|
|
}
|
|
|
|
fieldId="realmRole"
|
|
|
|
validated={errors.roleIds ? "error" : "default"}
|
2023-09-14 09:01:15 +00:00
|
|
|
helperTextInvalid={t("required")}
|
2023-05-24 12:11:06 +00:00
|
|
|
isRequired={user.length === 0}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="roleIds"
|
|
|
|
control={control}
|
|
|
|
defaultValue={[]}
|
|
|
|
rules={{
|
|
|
|
validate: (value) =>
|
|
|
|
(value || "").length > 0 || user.length > 0,
|
|
|
|
}}
|
|
|
|
render={({ field }) => (
|
|
|
|
<Select
|
|
|
|
placeholderText={t("selectARole")}
|
|
|
|
variant={SelectVariant.typeaheadMulti}
|
|
|
|
toggleId="role"
|
|
|
|
onToggle={setRoleDropdownOpen}
|
|
|
|
selections={field.value}
|
|
|
|
onSelect={(_, v) => {
|
|
|
|
const option = v.toString();
|
|
|
|
if (field.value?.includes(option)) {
|
|
|
|
field.onChange(
|
|
|
|
field.value.filter(
|
2023-07-11 14:03:21 +00:00
|
|
|
(item: string) => item !== option,
|
|
|
|
),
|
2023-05-24 12:11:06 +00:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
field.onChange([...(field.value || []), option]);
|
|
|
|
}
|
|
|
|
setRoleDropdownOpen(false);
|
|
|
|
}}
|
|
|
|
onClear={(event) => {
|
|
|
|
event.stopPropagation();
|
|
|
|
field.onChange([]);
|
|
|
|
}}
|
|
|
|
aria-label={t("realmRole")}
|
|
|
|
isOpen={roleDropdownOpen}
|
|
|
|
>
|
|
|
|
{clientRoles.map((role) => (
|
|
|
|
<SelectOption
|
|
|
|
selected={role.name === field.value}
|
|
|
|
key={role.name}
|
|
|
|
value={role.name}
|
|
|
|
/>
|
|
|
|
))}
|
|
|
|
</Select>
|
|
|
|
)}
|
2022-07-06 10:30:40 +00:00
|
|
|
/>
|
2023-05-24 12:11:06 +00:00
|
|
|
</FormGroup>
|
|
|
|
</FormAccess>
|
|
|
|
</PanelMainBody>
|
|
|
|
</Panel>
|
|
|
|
<Panel>
|
|
|
|
<PanelHeader>
|
2023-09-13 14:05:17 +00:00
|
|
|
<Title headingLevel="h2">{t("identityInformation")}</Title>
|
2023-05-24 12:11:06 +00:00
|
|
|
</PanelHeader>
|
|
|
|
<PanelMainBody>
|
|
|
|
<FormAccess isHorizontal role="view-clients">
|
2022-01-23 20:21:19 +00:00
|
|
|
<FormGroup
|
2023-05-24 12:11:06 +00:00
|
|
|
label={t("applyToResourceType")}
|
|
|
|
fieldId="applyToResourceType"
|
2022-01-23 20:21:19 +00:00
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-08 13:17:17 +00:00
|
|
|
helpText={t("applyToResourceTypeHelp")}
|
2023-09-13 14:05:17 +00:00
|
|
|
fieldLabelId="applyToResourceType"
|
2022-01-23 20:21:19 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
2023-05-24 12:11:06 +00:00
|
|
|
<Switch
|
|
|
|
id="applyToResource-switch"
|
2023-09-14 09:01:15 +00:00
|
|
|
label={t("on")}
|
|
|
|
labelOff={t("off")}
|
2023-05-24 12:11:06 +00:00
|
|
|
isChecked={applyToResourceType}
|
|
|
|
onChange={setApplyToResourceType}
|
|
|
|
aria-label={t("applyToResourceType")}
|
2022-01-23 20:21:19 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
2023-05-24 12:11:06 +00:00
|
|
|
|
|
|
|
{!applyToResourceType ? (
|
2022-07-06 10:30:40 +00:00
|
|
|
<FormGroup
|
2023-05-24 12:11:06 +00:00
|
|
|
label={t("resourcesAndScopes")}
|
|
|
|
id="resourcesAndScopes"
|
2022-07-06 10:30:40 +00:00
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-08 13:17:17 +00:00
|
|
|
helpText={t("contextualAttributesHelp")}
|
2023-05-24 12:11:06 +00:00
|
|
|
fieldLabelId={`resourcesAndScopes`}
|
2022-07-06 10:30:40 +00:00
|
|
|
/>
|
|
|
|
}
|
2023-05-24 12:11:06 +00:00
|
|
|
fieldId="resourcesAndScopes"
|
2022-07-06 10:30:40 +00:00
|
|
|
>
|
2023-05-24 12:11:06 +00:00
|
|
|
<KeyBasedAttributeInput
|
|
|
|
selectableValues={resources.map<AttributeType>((item) => ({
|
|
|
|
name: item.name!,
|
|
|
|
key: item._id!,
|
|
|
|
}))}
|
|
|
|
resources={resources}
|
|
|
|
name="resources"
|
2022-07-06 10:30:40 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
2023-05-24 12:11:06 +00:00
|
|
|
) : (
|
|
|
|
<>
|
|
|
|
<FormGroup
|
|
|
|
label={t("resourceType")}
|
|
|
|
isRequired
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-08 13:17:17 +00:00
|
|
|
helpText={t("resourceTypeHelp")}
|
2023-09-13 14:05:17 +00:00
|
|
|
fieldLabelId="resourceType"
|
2023-05-24 12:11:06 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
fieldId="client"
|
|
|
|
validated={errors.alias ? "error" : "default"}
|
2023-09-14 09:01:15 +00:00
|
|
|
helperTextInvalid={t("required")}
|
2023-05-24 12:11:06 +00:00
|
|
|
>
|
|
|
|
<KeycloakTextInput
|
|
|
|
id="alias"
|
|
|
|
aria-label="resource-type"
|
|
|
|
data-testid="alias"
|
|
|
|
{...register("alias", { required: true })}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("authScopes")}
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-13 14:05:17 +00:00
|
|
|
helpText={t("scopesSelect")}
|
|
|
|
fieldLabelId="client"
|
2023-05-24 12:11:06 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
fieldId="authScopes"
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="authScopes"
|
|
|
|
defaultValue={[]}
|
|
|
|
control={control}
|
|
|
|
render={({ field }) => (
|
|
|
|
<Select
|
|
|
|
toggleId="authScopes"
|
|
|
|
onToggle={setScopesDropdownOpen}
|
|
|
|
onSelect={(_, v) => {
|
|
|
|
const option = v.toString();
|
|
|
|
if (field.value.includes(option)) {
|
|
|
|
field.onChange(
|
|
|
|
field.value.filter(
|
2023-07-11 14:03:21 +00:00
|
|
|
(item: string) => item !== option,
|
|
|
|
),
|
2023-05-24 12:11:06 +00:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
field.onChange([...field.value, option]);
|
|
|
|
}
|
|
|
|
setScopesDropdownOpen(false);
|
|
|
|
}}
|
|
|
|
selections={field.value}
|
|
|
|
variant={SelectVariant.typeaheadMulti}
|
|
|
|
typeAheadAriaLabel={t("authScopes")}
|
|
|
|
isOpen={scopesDropdownOpen}
|
|
|
|
>
|
|
|
|
{scopes.map((scope) => (
|
|
|
|
<SelectOption
|
|
|
|
selected={field.value.includes(scope.name!)}
|
|
|
|
key={scope.id}
|
|
|
|
value={scope.name}
|
|
|
|
/>
|
|
|
|
))}
|
|
|
|
</Select>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
<ExpandableSection
|
|
|
|
toggleText={t("contextualInfo")}
|
|
|
|
onToggle={() => setIsExpanded(!isExpanded)}
|
|
|
|
isExpanded={isExpanded}
|
|
|
|
>
|
2022-07-06 10:30:40 +00:00
|
|
|
<FormGroup
|
2023-05-24 12:11:06 +00:00
|
|
|
label={t("contextualAttributes")}
|
|
|
|
id="contextualAttributes"
|
2022-07-06 10:30:40 +00:00
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-13 14:05:17 +00:00
|
|
|
helpText={t("contextualAttributesHelp")}
|
2023-05-24 12:11:06 +00:00
|
|
|
fieldLabelId={`contextualAttributes`}
|
2022-07-06 10:30:40 +00:00
|
|
|
/>
|
|
|
|
}
|
2023-09-14 09:01:15 +00:00
|
|
|
helperTextInvalid={t("required")}
|
2023-05-24 12:11:06 +00:00
|
|
|
fieldId="contextualAttributes"
|
2022-07-06 10:30:40 +00:00
|
|
|
>
|
2023-05-24 12:11:06 +00:00
|
|
|
<KeyBasedAttributeInput
|
|
|
|
selectableValues={defaultContextAttributes}
|
|
|
|
name="context.attributes"
|
2022-07-06 10:30:40 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
2023-05-24 12:11:06 +00:00
|
|
|
</ExpandableSection>
|
|
|
|
</FormAccess>
|
|
|
|
</PanelMainBody>
|
|
|
|
</Panel>
|
|
|
|
<ActionGroup>
|
|
|
|
<Button
|
|
|
|
data-testid="authorization-eval"
|
|
|
|
id="authorization-eval"
|
|
|
|
className="pf-u-mr-md"
|
|
|
|
isDisabled={!isValid}
|
|
|
|
onClick={() => evaluate()}
|
|
|
|
>
|
|
|
|
{t("evaluate")}
|
|
|
|
</Button>
|
|
|
|
<Button
|
|
|
|
data-testid="authorization-revert"
|
|
|
|
id="authorization-revert"
|
|
|
|
className="pf-u-mr-md"
|
|
|
|
variant="link"
|
|
|
|
onClick={() => reset()}
|
|
|
|
>
|
2023-09-14 09:01:15 +00:00
|
|
|
{t("revert")}
|
2023-05-24 12:11:06 +00:00
|
|
|
</Button>
|
|
|
|
</ActionGroup>
|
2022-07-06 10:30:40 +00:00
|
|
|
</FormProvider>
|
2022-01-23 20:21:19 +00:00
|
|
|
</PageSection>
|
|
|
|
);
|
|
|
|
};
|