made user required (#33771)

reverts changes made in https://github.com/keycloak/keycloak-ui/pull/4494

fixes: #33404

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-10-11 14:18:25 +02:00 committed by GitHub
parent 0ebf862b63
commit 243e357173
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,7 +25,7 @@ import {
Title,
} from "@patternfly/react-core";
import { useState } from "react";
import { FormProvider, useForm, useWatch } from "react-hook-form";
import { FormProvider, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { ForbiddenSection } from "../../ForbiddenSection";
import { useAdminClient } from "../../admin-client";
@ -96,7 +96,6 @@ const AuthorizationEvaluateContent = ({ client }: Props) => {
const form = useForm<EvaluateFormInputs>({ mode: "onChange" });
const {
control,
reset,
trigger,
formState: { isValid },
@ -179,9 +178,6 @@ const AuthorizationEvaluateContent = ({ client }: Props) => {
}
};
const user = useWatch({ control, name: "user", defaultValue: [] });
const roles = useWatch({ control, name: "roleIds", defaultValue: [] });
if (evaluateResult) {
return (
<Results
@ -213,7 +209,7 @@ const AuthorizationEvaluateContent = ({ client }: Props) => {
helpText={t("selectUser")}
defaultValue={[]}
variant="typeahead"
isRequired={roles?.length === 0}
isRequired
/>
<SelectControl
name="roleIds"
@ -224,10 +220,7 @@ const AuthorizationEvaluateContent = ({ client }: Props) => {
controller={{
defaultValue: [],
rules: {
required: {
value: user.length === 0,
message: t("required"),
},
required: true,
},
}}
options={clientRoles.map((role) => role.name!)}