restructure and add chooser when adding new
This commit is contained in:
parent
9e5104b668
commit
56a1b233d4
13 changed files with 1161 additions and 1118 deletions
|
@ -226,6 +226,12 @@ export const routes: RoutesFn = (t: TFunction) => [
|
|||
breadcrumb: null,
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/ldap/new",
|
||||
component: UserFederationLdapSettings,
|
||||
breadcrumb: t("common:settings"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/ldap/:id/:tab?",
|
||||
component: UserFederationLdapSettings,
|
||||
|
@ -238,12 +244,6 @@ export const routes: RoutesFn = (t: TFunction) => [
|
|||
breadcrumb: t("common:mappingDetails"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/ldap/new",
|
||||
component: UserFederationLdapSettings,
|
||||
breadcrumb: t("common:settings"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/",
|
||||
component: DashboardSection,
|
||||
|
|
|
@ -2,9 +2,7 @@ import { FormGroup, Switch, TextInput } from "@patternfly/react-core";
|
|||
import React from "react";
|
||||
import { HelpItem } from "../../../components/help-enabler/HelpItem";
|
||||
import { Controller, UseFormMethods } from "react-hook-form";
|
||||
import { FormAccess } from "../../../components/form-access/FormAccess";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LdapMapperGeneral } from "./shared/LdapMapperGeneral";
|
||||
|
||||
export type LdapMapperFullNameAttributeProps = {
|
||||
form: UseFormMethods;
|
||||
|
@ -18,87 +16,83 @@ export const LdapMapperFullNameAttribute = ({
|
|||
|
||||
return (
|
||||
<>
|
||||
<FormAccess role="manage-realm" isHorizontal>
|
||||
<LdapMapperGeneral form={form} />
|
||||
|
||||
<FormGroup
|
||||
label={t("ldapFullNameAttribute")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("ldapFullNameAttributeHelp")}
|
||||
forLabel={t("ldapFullNameAttribute")}
|
||||
forID="kc-full-name-attribute"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-full-name-attribute"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-full-name-attribute"
|
||||
data-testid="full-name-attribute"
|
||||
name="config.ldap-full-name-attribute"
|
||||
ref={form.register}
|
||||
<FormGroup
|
||||
label={t("ldapFullNameAttribute")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("ldapFullNameAttributeHelp")}
|
||||
forLabel={t("ldapFullNameAttribute")}
|
||||
forID="kc-full-name-attribute"
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("readOnly")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("readOnlyHelp")}
|
||||
forLabel={t("readOnly")}
|
||||
forID="kc-read-only"
|
||||
}
|
||||
fieldId="kc-full-name-attribute"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-full-name-attribute"
|
||||
data-testid="full-name-attribute"
|
||||
name="config.ldap-full-name-attribute"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("readOnly")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("readOnlyHelp")}
|
||||
forLabel={t("readOnly")}
|
||||
forID="kc-read-only"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-read-only"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.read-only"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-read-only"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
}
|
||||
fieldId="kc-read-only"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.read-only"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-read-only"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("writeOnly")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("writeOnlyHelp")}
|
||||
forLabel={t("writeOnly")}
|
||||
forID="kc-write-only"
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("writeOnly")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("writeOnlyHelp")}
|
||||
forLabel={t("writeOnly")}
|
||||
forID="kc-write-only"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-read-only"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.write-only"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-write-only"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
}
|
||||
fieldId="kc-read-only"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.write-only"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-write-only"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
</FormAccess>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -2,9 +2,7 @@ import { FormGroup, TextInput } from "@patternfly/react-core";
|
|||
import React from "react";
|
||||
import { HelpItem } from "../../../components/help-enabler/HelpItem";
|
||||
import { UseFormMethods } from "react-hook-form";
|
||||
import { FormAccess } from "../../../components/form-access/FormAccess";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LdapMapperGeneral } from "./shared/LdapMapperGeneral";
|
||||
|
||||
export type LdapMapperHardcodedAttributeProps = {
|
||||
form: UseFormMethods;
|
||||
|
@ -18,51 +16,48 @@ export const LdapMapperHardcodedAttribute = ({
|
|||
|
||||
return (
|
||||
<>
|
||||
<FormAccess role="manage-realm" isHorizontal>
|
||||
<LdapMapperGeneral form={form} />
|
||||
<FormGroup
|
||||
label={t("userModelAttributeName")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("userModelAttributeNameHelp")}
|
||||
forLabel={t("userModelAttributeName")}
|
||||
forID="kc-user-model-attribute"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-user-model-attribute"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-user-model-attribute"
|
||||
data-testid="user-model-attribute"
|
||||
name="config.user-model-attribute"
|
||||
ref={form.register}
|
||||
<FormGroup
|
||||
label={t("userModelAttributeName")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("userModelAttributeNameHelp")}
|
||||
forLabel={t("userModelAttributeName")}
|
||||
forID="kc-user-model-attribute"
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("attributeValue")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("attributeValueHelp")}
|
||||
forLabel={t("attributeValue")}
|
||||
forID="kc-attribute-value"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-attribute-value"
|
||||
}
|
||||
fieldId="kc-user-model-attribute"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-attribute-value"
|
||||
data-testid="attribute-value"
|
||||
name="config.attribute-value"
|
||||
ref={form.register}
|
||||
type="text"
|
||||
id="kc-user-model-attribute"
|
||||
data-testid="user-model-attribute"
|
||||
name="config.user-model-attribute"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("attributeValue")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("attributeValueHelp")}
|
||||
forLabel={t("attributeValue")}
|
||||
forID="kc-attribute-value"
|
||||
/>
|
||||
</FormGroup>
|
||||
</FormAccess>
|
||||
}
|
||||
fieldId="kc-attribute-value"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-attribute-value"
|
||||
data-testid="attribute-value"
|
||||
name="config.attribute-value"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -2,9 +2,7 @@ import { FormGroup, TextInput } from "@patternfly/react-core";
|
|||
import React from "react";
|
||||
import { HelpItem } from "../../../components/help-enabler/HelpItem";
|
||||
import { UseFormMethods } from "react-hook-form";
|
||||
import { FormAccess } from "../../../components/form-access/FormAccess";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LdapMapperGeneral } from "./shared/LdapMapperGeneral";
|
||||
|
||||
export type LdapMapperHardcodedLdapAttributeProps = {
|
||||
form: UseFormMethods;
|
||||
|
@ -18,52 +16,48 @@ export const LdapMapperHardcodedLdapAttribute = ({
|
|||
|
||||
return (
|
||||
<>
|
||||
<FormAccess role="manage-realm" isHorizontal>
|
||||
<LdapMapperGeneral form={form} />
|
||||
|
||||
<FormGroup
|
||||
label={t("ldapAttributeName")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("ldapAttributeNameHelp")}
|
||||
forLabel={t("ldapAttributeName")}
|
||||
forID="kc-ldap-attribute-name"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-ldap-attribute-name"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-ldap-attribute-name"
|
||||
data-testid="ldap-attribute-name"
|
||||
name="config.ldap-attribute-name"
|
||||
ref={form.register}
|
||||
<FormGroup
|
||||
label={t("ldapAttributeName")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("ldapAttributeNameHelp")}
|
||||
forLabel={t("ldapAttributeName")}
|
||||
forID="kc-ldap-attribute-name"
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("ldapAttributeValue")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("ldapAttributeValueHelp")}
|
||||
forLabel={t("ldapAttributeValue")}
|
||||
forID="kc-ldap-attribute-value"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-ldap-attribute-value"
|
||||
}
|
||||
fieldId="kc-ldap-attribute-name"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-ldap-attribute-value"
|
||||
data-testid="ldap-attribute-value"
|
||||
name="config.ldap-attribute-value"
|
||||
ref={form.register}
|
||||
type="text"
|
||||
id="kc-ldap-attribute-name"
|
||||
data-testid="ldap-attribute-name"
|
||||
name="config.ldap-attribute-name"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("ldapAttributeValue")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("ldapAttributeValueHelp")}
|
||||
forLabel={t("ldapAttributeValue")}
|
||||
forID="kc-ldap-attribute-value"
|
||||
/>
|
||||
</FormGroup>
|
||||
</FormAccess>
|
||||
}
|
||||
fieldId="kc-ldap-attribute-value"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-ldap-attribute-value"
|
||||
data-testid="ldap-attribute-value"
|
||||
name="config.ldap-attribute-value"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -2,9 +2,7 @@ import { FormGroup, TextInput } from "@patternfly/react-core";
|
|||
import React from "react";
|
||||
import { HelpItem } from "../../../components/help-enabler/HelpItem";
|
||||
import { UseFormMethods } from "react-hook-form";
|
||||
import { FormAccess } from "../../../components/form-access/FormAccess";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LdapMapperGeneral } from "./shared/LdapMapperGeneral";
|
||||
|
||||
export type LdapMapperHardcodedLdapGroupProps = {
|
||||
form: UseFormMethods;
|
||||
|
@ -18,30 +16,27 @@ export const LdapMapperHardcodedLdapGroup = ({
|
|||
|
||||
return (
|
||||
<>
|
||||
<FormAccess role="manage-realm" isHorizontal>
|
||||
<LdapMapperGeneral form={form} />
|
||||
<FormGroup
|
||||
label={t("group")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("groupHelp")}
|
||||
forLabel={t("group")}
|
||||
forID="kc-group"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-group"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-group"
|
||||
data-testid="group"
|
||||
name="config.group"
|
||||
ref={form.register}
|
||||
<FormGroup
|
||||
label={t("group")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("groupHelp")}
|
||||
forLabel={t("group")}
|
||||
forID="kc-group"
|
||||
/>
|
||||
</FormGroup>
|
||||
</FormAccess>
|
||||
}
|
||||
fieldId="kc-group"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-group"
|
||||
data-testid="group"
|
||||
name="config.group"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -2,9 +2,7 @@ import { FormGroup, TextInput } from "@patternfly/react-core";
|
|||
import React from "react";
|
||||
import { HelpItem } from "../../../components/help-enabler/HelpItem";
|
||||
import { UseFormMethods } from "react-hook-form";
|
||||
import { FormAccess } from "../../../components/form-access/FormAccess";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LdapMapperGeneral } from "./shared/LdapMapperGeneral";
|
||||
|
||||
export type LdapMapperHardcodedLdapRoleProps = {
|
||||
form: UseFormMethods;
|
||||
|
@ -18,30 +16,27 @@ export const LdapMapperHardcodedLdapRole = ({
|
|||
|
||||
return (
|
||||
<>
|
||||
<FormAccess role="manage-realm" isHorizontal>
|
||||
<LdapMapperGeneral form={form} />
|
||||
<FormGroup
|
||||
label={t("common:role")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("roleHelp")}
|
||||
forLabel={t("common:role")}
|
||||
forID="kc-role"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-role"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-role"
|
||||
data-testid="role"
|
||||
name="config.role"
|
||||
ref={form.register}
|
||||
<FormGroup
|
||||
label={t("common:role")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("roleHelp")}
|
||||
forLabel={t("common:role")}
|
||||
forID="kc-role"
|
||||
/>
|
||||
</FormGroup>
|
||||
</FormAccess>
|
||||
}
|
||||
fieldId="kc-role"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-role"
|
||||
data-testid="role"
|
||||
name="config.role"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -10,20 +10,17 @@ import {
|
|||
useAdminClient,
|
||||
asyncStateFetch,
|
||||
} from "../../../context/auth/AdminClient";
|
||||
import { Link, useParams, useRouteMatch } from "react-router-dom";
|
||||
import { Link, useHistory, useParams, useRouteMatch } from "react-router-dom";
|
||||
|
||||
export const LdapMapperList = () => {
|
||||
const [mappers, setMappers] = useState<ComponentRepresentation[]>();
|
||||
|
||||
const history = useHistory();
|
||||
const { t } = useTranslation("user-federation");
|
||||
const adminClient = useAdminClient();
|
||||
const { addAlert } = useAlerts();
|
||||
|
||||
const { url } = useRouteMatch();
|
||||
|
||||
const handleError = useErrorHandler();
|
||||
const [key, setKey] = useState(0);
|
||||
|
||||
const { id } = useParams<{ id: string }>();
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -95,13 +92,7 @@ export const LdapMapperList = () => {
|
|||
<Button
|
||||
data-testid="createMapperBtn"
|
||||
variant="primary"
|
||||
// onClick={handleModalToggle}
|
||||
onClick={() =>
|
||||
addAlert(
|
||||
t("Add functionality not implemented yet!"),
|
||||
AlertVariant.success
|
||||
)
|
||||
}
|
||||
onClick={() => history.push(`${url}/new`)}
|
||||
>
|
||||
{t("common:addMapper")}
|
||||
</Button>
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
import React from "react";
|
||||
import { UseFormMethods } from "react-hook-form";
|
||||
import { FormAccess } from "../../../components/form-access/FormAccess";
|
||||
import { LdapMapperGeneral } from "./shared/LdapMapperGeneral";
|
||||
|
||||
export type LdapMapperMsadLdsUserAccountProps = {
|
||||
form: UseFormMethods;
|
||||
};
|
||||
|
||||
export const LdapMapperMsadLdsUserAccount = ({
|
||||
form,
|
||||
}: LdapMapperMsadLdsUserAccountProps) => {
|
||||
return (
|
||||
<>
|
||||
<FormAccess role="manage-realm" isHorizontal>
|
||||
<LdapMapperGeneral form={form} />
|
||||
</FormAccess>
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -2,9 +2,7 @@ import { FormGroup, Switch } from "@patternfly/react-core";
|
|||
import React from "react";
|
||||
import { HelpItem } from "../../../components/help-enabler/HelpItem";
|
||||
import { Controller, UseFormMethods } from "react-hook-form";
|
||||
import { FormAccess } from "../../../components/form-access/FormAccess";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LdapMapperGeneral } from "./shared/LdapMapperGeneral";
|
||||
|
||||
export type LdapMapperMsadUserAccountProps = {
|
||||
form: UseFormMethods;
|
||||
|
@ -18,37 +16,34 @@ export const LdapMapperMsadUserAccount = ({
|
|||
|
||||
return (
|
||||
<>
|
||||
<FormAccess role="manage-realm" isHorizontal>
|
||||
<LdapMapperGeneral form={form} />
|
||||
<FormGroup
|
||||
label={t("passwordPolicyHintsEnabled")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("passwordPolicyHintsEnabledHelp")}
|
||||
forLabel={t("passwordPolicyHintsEnabled")}
|
||||
forID="kc-pw-policy-hints-enabled"
|
||||
<FormGroup
|
||||
label={t("passwordPolicyHintsEnabled")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("passwordPolicyHintsEnabledHelp")}
|
||||
forLabel={t("passwordPolicyHintsEnabled")}
|
||||
forID="kc-pw-policy-hints-enabled"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-der-formatted"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.ldap-password-policy-hints-enabled"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-pw-policy-hints-enabled"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
}
|
||||
fieldId="kc-der-formatted"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.ldap-password-policy-hints-enabled"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-pw-policy-hints-enabled"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
</FormAccess>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,7 @@ import { FormGroup, Switch, TextInput } from "@patternfly/react-core";
|
|||
import React from "react";
|
||||
import { HelpItem } from "../../../components/help-enabler/HelpItem";
|
||||
import { Controller, UseFormMethods } from "react-hook-form";
|
||||
import { FormAccess } from "../../../components/form-access/FormAccess";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LdapMapperGeneral } from "./shared/LdapMapperGeneral";
|
||||
|
||||
export type LdapMapperUserAttributeProps = {
|
||||
form: UseFormMethods;
|
||||
|
@ -20,197 +18,194 @@ export const LdapMapperUserAttribute = ({
|
|||
|
||||
return (
|
||||
<>
|
||||
<FormAccess role="manage-realm" isHorizontal>
|
||||
<LdapMapperGeneral form={form} />
|
||||
<FormGroup
|
||||
label={t("userModelAttribute")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("userModelAttributeHelp")}
|
||||
forLabel={t("userModelAttribute")}
|
||||
forID="kc-user-model-attribute"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-user-model-attribute"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-user-model-attribute"
|
||||
data-testid="user-model-attribute"
|
||||
name="config.user-model-attribute"
|
||||
ref={form.register}
|
||||
<FormGroup
|
||||
label={t("userModelAttribute")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("userModelAttributeHelp")}
|
||||
forLabel={t("userModelAttribute")}
|
||||
forID="kc-user-model-attribute"
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("ldapAttribute")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("ldapAttributeHelp")}
|
||||
forLabel={t("ldapAttribute")}
|
||||
forID="kc-ldap-attribute"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-ldap-attribute"
|
||||
}
|
||||
fieldId="kc-user-model-attribute"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-ldap-attribute"
|
||||
data-testid="ldap-attribute"
|
||||
name="config.ldap-attribute"
|
||||
ref={form.register}
|
||||
type="text"
|
||||
id="kc-user-model-attribute"
|
||||
data-testid="user-model-attribute"
|
||||
name="config.user-model-attribute"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("ldapAttribute")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("ldapAttributeHelp")}
|
||||
forLabel={t("ldapAttribute")}
|
||||
forID="kc-ldap-attribute"
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("readOnly")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("readOnlyHelp")}
|
||||
forLabel={t("readOnly")}
|
||||
forID="kc-read-only"
|
||||
}
|
||||
fieldId="kc-ldap-attribute"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-ldap-attribute"
|
||||
data-testid="ldap-attribute"
|
||||
name="config.ldap-attribute"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("readOnly")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("readOnlyHelp")}
|
||||
forLabel={t("readOnly")}
|
||||
forID="kc-read-only"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-read-only"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.read-only"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-read-only"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
}
|
||||
fieldId="kc-read-only"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.read-only"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-read-only"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("alwaysReadValueFromLdap")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("alwaysReadValueFromLdapHelp")}
|
||||
forLabel={t("alwaysReadValueFromLdap")}
|
||||
forID="kc-always-read-value"
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("alwaysReadValueFromLdap")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("alwaysReadValueFromLdapHelp")}
|
||||
forLabel={t("alwaysReadValueFromLdap")}
|
||||
forID="kc-always-read-value"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-always-read-value"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.always-read-value-from-ldap"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-always-read-value"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
}
|
||||
fieldId="kc-always-read-value"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.always-read-value-from-ldap"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-always-read-value"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("isMandatoryInLdap")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("isMandatoryInLdapHelp")}
|
||||
forLabel={t("isMandatoryInLdap")}
|
||||
forID="kc-is-mandatory"
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("isMandatoryInLdap")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("isMandatoryInLdapHelp")}
|
||||
forLabel={t("isMandatoryInLdap")}
|
||||
forID="kc-is-mandatory"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-is-mandatory"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.is-mandatory-in-ldap"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-is-mandatory"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
}
|
||||
fieldId="kc-is-mandatory"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.is-mandatory-in-ldap"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-is-mandatory"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("isBinaryAttribute")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("isBinaryAttributeHelp")}
|
||||
forLabel={t("isBinaryAttribute")}
|
||||
forID="kc-is-binary"
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("isBinaryAttribute")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("isBinaryAttributeHelp")}
|
||||
forLabel={t("isBinaryAttribute")}
|
||||
forID="kc-is-binary"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-is-binary"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.is-binary-attribute"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-is-binary"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
}
|
||||
fieldId="kc-is-binary"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.is-binary-attribute"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-is-binary"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
{mapperType === "certificate-ldap-mapper" ? (
|
||||
<>
|
||||
<FormGroup
|
||||
label={t("derFormatted")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("derFormattedHelp")}
|
||||
forLabel={t("derFormatted")}
|
||||
forID="kc-der-formatted"
|
||||
/>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
{mapperType === "certificate-ldap-mapper" ? (
|
||||
<>
|
||||
<FormGroup
|
||||
label={t("derFormatted")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("derFormattedHelp")}
|
||||
forLabel={t("derFormatted")}
|
||||
forID="kc-der-formatted"
|
||||
}
|
||||
fieldId="kc-der-formatted"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.is-der-formatted"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-der-formatted"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
}
|
||||
fieldId="kc-der-formatted"
|
||||
hasNoPaddingTop
|
||||
>
|
||||
<Controller
|
||||
name="config.is-der-formatted"
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
id={"kc-der-formatted"}
|
||||
isDisabled={false}
|
||||
onChange={(value) => onChange([`${value}`])}
|
||||
isChecked={value[0] === "true"}
|
||||
label={t("common:on")}
|
||||
labelOff={t("common:off")}
|
||||
/>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
</>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</FormAccess>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
</>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -4,20 +4,26 @@ import {
|
|||
AlertVariant,
|
||||
Button,
|
||||
Form,
|
||||
FormGroup,
|
||||
PageSection,
|
||||
Select,
|
||||
SelectOption,
|
||||
SelectVariant,
|
||||
TextInput,
|
||||
} from "@patternfly/react-core";
|
||||
import { convertToFormValues } from "../../../util";
|
||||
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
||||
import { useAdminClient } from "../../../context/auth/AdminClient";
|
||||
import { ViewHeader } from "../../../components/view-header/ViewHeader";
|
||||
import { useHistory, useParams } from "react-router-dom";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { Controller, useForm, useWatch } from "react-hook-form";
|
||||
import { useAlerts } from "../../../components/alert/Alerts";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { HelpItem } from "../../../components/help-enabler/HelpItem";
|
||||
import { FormAccess } from "../../../components/form-access/FormAccess";
|
||||
|
||||
import { LdapMapperUserAttribute } from "./LdapMapperUserAttribute";
|
||||
import { LdapMapperMsadUserAccount } from "./LdapMapperMsadUserAccount";
|
||||
import { LdapMapperMsadLdsUserAccount } from "./LdapMapperMsadLdsUserAccount";
|
||||
import { LdapMapperFullNameAttribute } from "./LdapMapperFullNameAttribute";
|
||||
|
||||
import { LdapMapperHardcodedLdapRole } from "./LdapMapperHardcodedLdapRole";
|
||||
|
@ -26,7 +32,6 @@ import { LdapMapperHardcodedLdapAttribute } from "./LdapMapperHardcodedLdapAttri
|
|||
import { LdapMapperHardcodedAttribute } from "./LdapMapperHardcodedAttribute";
|
||||
|
||||
import { LdapMapperRoleGroup } from "./LdapMapperRoleGroup";
|
||||
|
||||
import { useRealm } from "../../../context/realm-context/RealmContext";
|
||||
|
||||
export const LdapMappingDetails = () => {
|
||||
|
@ -40,20 +45,25 @@ export const LdapMappingDetails = () => {
|
|||
const { realm } = useRealm();
|
||||
const id = mapperId;
|
||||
const { t } = useTranslation("user-federation");
|
||||
const helpText = useTranslation("user-federation-help").t;
|
||||
const { addAlert } = useAlerts();
|
||||
|
||||
const [isMapperDropdownOpen, setIsMapperDropdownOpen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
if (mapperId) {
|
||||
const fetchedMapper = await adminClient.components.findOne({ id });
|
||||
if (fetchedMapper) {
|
||||
// TODO: remove after adding all mapper types
|
||||
console.log("LdapMappingDetails: id used in findOne(id) call::");
|
||||
console.log(id);
|
||||
console.log("LdapMappingDetails: data returned from findOne(id):");
|
||||
console.log(fetchedMapper);
|
||||
setMapper(fetchedMapper);
|
||||
setupForm(fetchedMapper);
|
||||
if (mapperId !== "new") {
|
||||
if (mapperId) {
|
||||
const fetchedMapper = await adminClient.components.findOne({ id });
|
||||
if (fetchedMapper) {
|
||||
// TODO: remove after adding all mapper types
|
||||
console.log("LdapMappingDetails: id used in findOne(id) call::");
|
||||
console.log(id);
|
||||
console.log("LdapMappingDetails: data returned from findOne(id):");
|
||||
console.log(fetchedMapper);
|
||||
setMapper(fetchedMapper);
|
||||
setupForm(fetchedMapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
@ -78,63 +88,240 @@ export const LdapMappingDetails = () => {
|
|||
),
|
||||
AlertVariant.success
|
||||
);
|
||||
history.push(`/${realm}/user-federation`);
|
||||
history.push(`/${realm}/user-federation/ldap/${mapper!.parentId}/mappers`);
|
||||
};
|
||||
|
||||
const mapperType = useWatch({
|
||||
control: form.control,
|
||||
name: "choose-mapper-type",
|
||||
});
|
||||
|
||||
const isNew = mapperId === "new";
|
||||
|
||||
return (
|
||||
<>
|
||||
<ViewHeader titleKey={mapper ? mapper.name! : ""} subKey="" />
|
||||
<ViewHeader
|
||||
titleKey={mapper ? mapper.name! : "Create new mapper"}
|
||||
subKey=""
|
||||
/>
|
||||
<PageSection variant="light" isFilled>
|
||||
{mapper
|
||||
? (mapper.providerId! === "certificate-ldap-mapper" ||
|
||||
mapper.providerId! === "user-attribute-ldap-mapper") && (
|
||||
<LdapMapperUserAttribute
|
||||
form={form}
|
||||
mapperType={mapper?.providerId}
|
||||
<FormAccess role="manage-realm" isHorizontal>
|
||||
{!isNew && (
|
||||
<FormGroup label={t("common:id")} fieldId="kc-ldap-mapper-id">
|
||||
<TextInput
|
||||
isDisabled
|
||||
type="text"
|
||||
id="kc-ldap-mapper-id"
|
||||
data-testid="ldap-mapper-id"
|
||||
name="id"
|
||||
ref={form.register}
|
||||
/>
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? mapper.providerId! === "msad-user-account-control-mapper" && (
|
||||
<LdapMapperMsadUserAccount form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? mapper.providerId! === "msad-lds-user-account-control-mapper" && (
|
||||
<LdapMapperMsadLdsUserAccount form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? mapper.providerId! === "full-name-ldap-mapper" && (
|
||||
<LdapMapperFullNameAttribute form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? mapper.providerId! === "hardcoded-ldap-role-mapper" && (
|
||||
<LdapMapperHardcodedLdapRole form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? mapper.providerId! === "hardcoded-ldap-group-mapper" && (
|
||||
<LdapMapperHardcodedLdapGroup form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? mapper.providerId! === "hardcoded-ldap-attribute-mapper" && (
|
||||
<LdapMapperHardcodedLdapAttribute form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? mapper.providerId! === "hardcoded-attribute-mapper" && (
|
||||
<LdapMapperHardcodedAttribute form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? (mapper.providerId! === "role-ldap-mapper" ||
|
||||
mapper.providerId! === "group-ldap-mapper") && (
|
||||
<LdapMapperRoleGroup form={form} type={mapper.providerId} />
|
||||
)
|
||||
: ""}
|
||||
</FormGroup>
|
||||
)}
|
||||
<FormGroup
|
||||
label={t("common:name")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("nameHelp")}
|
||||
forLabel={t("common:name")}
|
||||
forID="kc-ldap-mapper-name"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-ldap-mapper-name"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isDisabled={!isNew}
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-ldap-mapper-name"
|
||||
data-testid="ldap-mapper-name"
|
||||
name="name"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
{!isNew ? (
|
||||
<FormGroup
|
||||
label={t("common:mapperType")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("mapperTypeHelp")}
|
||||
forLabel={t("common:mapperType")}
|
||||
forID="kc-ldap-mapper-type"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-ldap-mapper-type"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isDisabled={!isNew}
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-ldap-mapper-type"
|
||||
data-testid="ldap-mapper-type"
|
||||
name="providerId"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
) : (
|
||||
<FormGroup
|
||||
label={t("common:mapperType")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("mapperTypeHelp")}
|
||||
forLabel={t("common:mapperType")}
|
||||
forID="kc-choose-mapper-type"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-choose-mapper-type"
|
||||
isRequired
|
||||
>
|
||||
<Controller
|
||||
name="choose-mapper-type"
|
||||
defaultValue=" "
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Select
|
||||
toggleId="kc-choose-mapper-type"
|
||||
required
|
||||
onToggle={() =>
|
||||
setIsMapperDropdownOpen(!isMapperDropdownOpen)
|
||||
}
|
||||
isOpen={isMapperDropdownOpen}
|
||||
onSelect={(_, value) => {
|
||||
onChange(value as string);
|
||||
setIsMapperDropdownOpen(false);
|
||||
}}
|
||||
selections={value}
|
||||
variant={SelectVariant.single}
|
||||
// data-testid="choose-mapper-type"
|
||||
>
|
||||
<SelectOption
|
||||
key={0}
|
||||
value="msad-user-account-control-mapper"
|
||||
/>
|
||||
<SelectOption
|
||||
key={1}
|
||||
value="msda-lds-user-account-control-mapper"
|
||||
/>
|
||||
<SelectOption key={2} value="group-ldap-mapper" />
|
||||
<SelectOption key={3} value="user-attribute-ldap-mapper" />
|
||||
<SelectOption key={4} value="role-ldap-mapper" />
|
||||
<SelectOption key={5} value="hardcoded-attribute-mapper" />
|
||||
<SelectOption key={6} value="hardcoded-ldap-role-mapper" />
|
||||
<SelectOption key={7} value="certificate-ldap-mapper" />
|
||||
<SelectOption key={8} value="full-name-ldap-mapper" />
|
||||
<SelectOption key={9} value="hardcoded-ldap-group-mapper" />
|
||||
<SelectOption
|
||||
key={10}
|
||||
value="hardcoded-ldap-attribute-mapper"
|
||||
/>
|
||||
</Select>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
)}
|
||||
{/* When loading existing mappers, load forms based on providerId aka mapper type */}
|
||||
{mapper
|
||||
? (mapper.providerId! === "certificate-ldap-mapper" ||
|
||||
mapper.providerId! === "user-attribute-ldap-mapper") && (
|
||||
<LdapMapperUserAttribute
|
||||
form={form}
|
||||
mapperType={mapper?.providerId}
|
||||
/>
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? mapper.providerId! === "msad-user-account-control-mapper" && (
|
||||
<LdapMapperMsadUserAccount form={form} />
|
||||
)
|
||||
: ""}
|
||||
{/* msad-lds-user-account-control-mapper does not need a component
|
||||
because it is just id, name, and mapper type*/}
|
||||
{mapper
|
||||
? mapper.providerId! === "full-name-ldap-mapper" && (
|
||||
<LdapMapperFullNameAttribute form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? mapper.providerId! === "hardcoded-ldap-role-mapper" && (
|
||||
<LdapMapperHardcodedLdapRole form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? mapper.providerId! === "hardcoded-ldap-group-mapper" && (
|
||||
<LdapMapperHardcodedLdapGroup form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? mapper.providerId! === "hardcoded-ldap-attribute-mapper" && (
|
||||
<LdapMapperHardcodedLdapAttribute form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? mapper.providerId! === "hardcoded-attribute-mapper" && (
|
||||
<LdapMapperHardcodedAttribute form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapper
|
||||
? (mapper.providerId! === "role-ldap-mapper" ||
|
||||
mapper.providerId! === "group-ldap-mapper") && (
|
||||
<LdapMapperRoleGroup form={form} type={mapper.providerId} />
|
||||
)
|
||||
: ""}
|
||||
{/* When creating new mappers, load forms based on dropdown selection */}
|
||||
{mapperType
|
||||
? mapperType === "certificate-ldap-mapper" && (
|
||||
<LdapMapperUserAttribute form={form} mapperType={mapperType} />
|
||||
)
|
||||
: ""}
|
||||
{mapperType
|
||||
? mapperType === "user-attribute-ldap-mapper" && (
|
||||
<LdapMapperUserAttribute form={form} mapperType={mapperType} />
|
||||
)
|
||||
: ""}
|
||||
{mapperType
|
||||
? mapperType === "msad-user-account-control-mapper" && (
|
||||
<LdapMapperMsadUserAccount form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapperType
|
||||
? mapperType === "full-name-ldap-mapper" && (
|
||||
<LdapMapperFullNameAttribute form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapperType
|
||||
? mapperType === "hardcoded-ldap-role-mapper" && (
|
||||
<LdapMapperHardcodedLdapRole form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapperType
|
||||
? mapperType === "hardcoded-ldap-group-mapper" && (
|
||||
<LdapMapperHardcodedLdapGroup form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapperType
|
||||
? mapperType === "hardcoded-ldap-attribute-mapper" && (
|
||||
<LdapMapperHardcodedLdapAttribute form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapperType
|
||||
? mapperType === "hardcoded-attribute-mapper" && (
|
||||
<LdapMapperHardcodedAttribute form={form} />
|
||||
)
|
||||
: ""}
|
||||
{mapperType
|
||||
? mapperType === "role-ldap-mapper" && (
|
||||
<LdapMapperRoleGroup form={form} type={mapperType} />
|
||||
)
|
||||
: ""}
|
||||
{mapperType
|
||||
? mapperType === "group-ldap-mapper" && (
|
||||
<LdapMapperRoleGroup form={form} type={mapperType} />
|
||||
)
|
||||
: ""}
|
||||
</FormAccess>
|
||||
|
||||
<Form onSubmit={form.handleSubmit(save)}>
|
||||
<ActionGroup>
|
||||
<Button
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
import { FormGroup, TextInput } from "@patternfly/react-core";
|
||||
import React from "react";
|
||||
import { HelpItem } from "../../../../components/help-enabler/HelpItem";
|
||||
import { UseFormMethods } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export type LdapMapperGeneralProps = {
|
||||
form: UseFormMethods;
|
||||
};
|
||||
|
||||
export const LdapMapperGeneral = ({ form }: LdapMapperGeneralProps) => {
|
||||
const { t } = useTranslation("user-federation");
|
||||
const helpText = useTranslation("user-federation-help").t;
|
||||
|
||||
return (
|
||||
<>
|
||||
<FormGroup label={t("common:id")} fieldId="kc-ldap-mapper-id">
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-ldap-mapper-id"
|
||||
data-testid="ldap-mapper-id"
|
||||
name="id"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("common:name")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("nameHelp")}
|
||||
forLabel={t("common:name")}
|
||||
forID="kc-ldap-mapper-name"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-ldap-mapper-name"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-ldap-mapper-name"
|
||||
data-testid="ldap-mapper-name"
|
||||
name="name"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={t("common:mapperType")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("mapperTypeHelp")}
|
||||
forLabel={t("common:mapperType")}
|
||||
forID="kc-ldap-mapper-type"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-ldap-mapper-type"
|
||||
isRequired
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="kc-ldap-mapper-type"
|
||||
data-testid="ldap-mapper-type"
|
||||
name="providerId"
|
||||
ref={form.register}
|
||||
/>
|
||||
</FormGroup>
|
||||
</>
|
||||
);
|
||||
};
|
Loading…
Reference in a new issue