nine of eleven mappers complete
This commit is contained in:
parent
3e3b1d2bed
commit
f1f9f8736c
11 changed files with 458 additions and 8 deletions
104
src/user-federation/ldap/mappers/LdapMapperFullNameAttribute.tsx
Normal file
104
src/user-federation/ldap/mappers/LdapMapperFullNameAttribute.tsx
Normal file
|
@ -0,0 +1,104 @@
|
|||
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;
|
||||
};
|
||||
|
||||
export const LdapMapperFullNameAttribute = ({
|
||||
form,
|
||||
}: LdapMapperFullNameAttributeProps) => {
|
||||
const { t } = useTranslation("user-federation");
|
||||
const helpText = useTranslation("user-federation-help").t;
|
||||
|
||||
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>
|
||||
<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")}
|
||||
/>
|
||||
)}
|
||||
></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")}
|
||||
/>
|
||||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
</FormAccess>
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,68 @@
|
|||
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;
|
||||
};
|
||||
|
||||
export const LdapMapperHardcodedAttribute = ({
|
||||
form,
|
||||
}: LdapMapperHardcodedAttributeProps) => {
|
||||
const { t } = useTranslation("user-federation");
|
||||
const helpText = useTranslation("user-federation-help").t;
|
||||
|
||||
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>
|
||||
<FormGroup
|
||||
label={t("attributeValue")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("attributeValueHelp")}
|
||||
forLabel={t("attributeValue")}
|
||||
forID="kc-attribute-value"
|
||||
/>
|
||||
}
|
||||
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>
|
||||
</FormAccess>
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,69 @@
|
|||
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;
|
||||
};
|
||||
|
||||
export const LdapMapperHardcodedLdapAttribute = ({
|
||||
form,
|
||||
}: LdapMapperHardcodedLdapAttributeProps) => {
|
||||
const { t } = useTranslation("user-federation");
|
||||
const helpText = useTranslation("user-federation-help").t;
|
||||
|
||||
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>
|
||||
<FormGroup
|
||||
label={t("ldapAttributeValue")}
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("ldapAttributeValueHelp")}
|
||||
forLabel={t("ldapAttributeValue")}
|
||||
forID="kc-ldap-attribute-value"
|
||||
/>
|
||||
}
|
||||
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>
|
||||
</FormAccess>
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,47 @@
|
|||
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;
|
||||
};
|
||||
|
||||
export const LdapMapperHardcodedLdapGroup = ({
|
||||
form,
|
||||
}: LdapMapperHardcodedLdapGroupProps) => {
|
||||
const { t } = useTranslation("user-federation");
|
||||
const helpText = useTranslation("user-federation-help").t;
|
||||
|
||||
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>
|
||||
</FormAccess>
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,47 @@
|
|||
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;
|
||||
};
|
||||
|
||||
export const LdapMapperHardcodedLdapRole = ({
|
||||
form,
|
||||
}: LdapMapperHardcodedLdapRoleProps) => {
|
||||
const { t } = useTranslation("user-federation");
|
||||
const helpText = useTranslation("user-federation-help").t;
|
||||
|
||||
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>
|
||||
</FormAccess>
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,20 @@
|
|||
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>
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,54 @@
|
|||
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;
|
||||
};
|
||||
|
||||
export const LdapMapperMsadUserAccount = ({
|
||||
form,
|
||||
}: LdapMapperMsadUserAccountProps) => {
|
||||
const { t } = useTranslation("user-federation");
|
||||
const helpText = useTranslation("user-federation-help").t;
|
||||
|
||||
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"
|
||||
/>
|
||||
}
|
||||
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>
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -120,7 +120,6 @@ export const LdapMapperUserAttribute = ({
|
|||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
|
||||
<FormGroup
|
||||
label={t("isMandatoryInLdap")}
|
||||
labelIcon={
|
||||
|
@ -149,7 +148,6 @@ export const LdapMapperUserAttribute = ({
|
|||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
|
||||
<FormGroup
|
||||
label={t("isBinaryAttribute")}
|
||||
labelIcon={
|
||||
|
@ -178,7 +176,6 @@ export const LdapMapperUserAttribute = ({
|
|||
)}
|
||||
></Controller>
|
||||
</FormGroup>
|
||||
|
||||
{mapperType === "certificate-ldap-mapper" ? (
|
||||
<>
|
||||
<FormGroup
|
||||
|
@ -186,8 +183,8 @@ export const LdapMapperUserAttribute = ({
|
|||
labelIcon={
|
||||
<HelpItem
|
||||
helpText={helpText("derFormattedHelp")}
|
||||
forLabel={t("useKerberosForPasswordAuthentication")}
|
||||
forID="kc-use-kerberos-password-authentication"
|
||||
forLabel={t("derFormatted")}
|
||||
forID="kc-der-formatted"
|
||||
/>
|
||||
}
|
||||
fieldId="kc-der-formatted"
|
||||
|
|
|
@ -14,7 +14,17 @@ import { useHistory, useParams } from "react-router-dom";
|
|||
import { useForm } from "react-hook-form";
|
||||
import { useAlerts } from "../../../components/alert/Alerts";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { LdapMapperUserAttribute } from "./LdapMapperUserAttribute";
|
||||
import { LdapMapperMsadUserAccount } from "./LdapMapperMsadUserAccount";
|
||||
import { LdapMapperMsadLdsUserAccount } from "./LdapMapperMsadLdsUserAccount";
|
||||
import { LdapMapperFullNameAttribute } from "./LdapMapperFullNameAttribute";
|
||||
|
||||
import { LdapMapperHardcodedLdapRole } from "./LdapMapperHardcodedLdapRole";
|
||||
import { LdapMapperHardcodedLdapGroup } from "./LdapMapperHardcodedLdapGroup";
|
||||
import { LdapMapperHardcodedLdapAttribute } from "./LdapMapperHardcodedLdapAttribute";
|
||||
import { LdapMapperHardcodedAttribute } from "./LdapMapperHardcodedAttribute";
|
||||
|
||||
import { useRealm } from "../../../context/realm-context/RealmContext";
|
||||
|
||||
export const LdapMappingDetails = () => {
|
||||
|
@ -81,6 +91,41 @@ export const LdapMappingDetails = () => {
|
|||
/>
|
||||
)
|
||||
: ""}
|
||||
{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} />
|
||||
)
|
||||
: ""}
|
||||
<Form onSubmit={form.handleSubmit(save)}>
|
||||
<ActionGroup>
|
||||
<Button
|
||||
|
|
|
@ -8,9 +8,7 @@ export type LdapMapperGeneralProps = {
|
|||
form: UseFormMethods;
|
||||
};
|
||||
|
||||
export const LdapMapperGeneral = ({
|
||||
form,
|
||||
}: LdapMapperGeneralProps) => {
|
||||
export const LdapMapperGeneral = ({ form }: LdapMapperGeneralProps) => {
|
||||
const { t } = useTranslation("user-federation");
|
||||
const helpText = useTranslation("user-federation-help").t;
|
||||
|
||||
|
|
|
@ -132,6 +132,7 @@
|
|||
"mapperTypeLdapAttributeMapper": "hardcoded-ldap-attribute-mapper",
|
||||
|
||||
"ldapMappersList": "LDAP Mappers",
|
||||
|
||||
"ldapFullNameAttribute": "LDAP full name attribute",
|
||||
"writeOnly": "Write only",
|
||||
|
||||
|
|
Loading…
Reference in a new issue