diff --git a/src/user-federation/ldap/mappers/LdapMapperDetails.tsx b/src/user-federation/ldap/mappers/LdapMapperDetails.tsx index 21658835fd..9aabc6dc68 100644 --- a/src/user-federation/ldap/mappers/LdapMapperDetails.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperDetails.tsx @@ -81,15 +81,17 @@ export const LdapMapperDetails = () => { const save = async (mapper: ComponentRepresentation) => { const config = convertFormValuesToObject(mapper.config); - const map = {...mapping, config }; + const map = { ...mapping, config }; try { if (id) { if (id === "new") { await adminClient.components.create(mapper); - history.push(`/${realm}/user-federation/ldap/${mapper!.parentId}/mappers`); + history.push( + `/${realm}/user-federation/ldap/${mapper!.parentId}/mappers` + ); } else { // TODO remove after debugging each mapper type - console.log(`On save - mapping is:`) + console.log(`On save - mapping is:`); console.log(`${JSON.stringify(mapping)}`); console.log(`id is:`); console.log(`${id}`); @@ -246,7 +248,7 @@ export const LdapMapperDetails = () => { {/* When loading existing mappers, load forms based on providerId aka mapper type */} {mapping ? (mapping.providerId! === "certificate-ldap-mapper" || - mapping.providerId! === "user-attribute-ldap-mapper") && ( + mapping.providerId! === "user-attribute-ldap-mapper") && ( { : ""} {mapping ? (mapping.providerId! === "role-ldap-mapper" || - mapping.providerId! === "group-ldap-mapper") && ( + mapping.providerId! === "group-ldap-mapper") && ( ) : ""} diff --git a/src/user-federation/ldap/mappers/LdapMapperFullNameAttribute.tsx b/src/user-federation/ldap/mappers/LdapMapperFullNameAttribute.tsx index 356eab95de..e392918949 100644 --- a/src/user-federation/ldap/mappers/LdapMapperFullNameAttribute.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperFullNameAttribute.tsx @@ -33,7 +33,7 @@ export const LdapMapperFullNameAttribute = ({ type="text" id="kc-full-name-attribute" data-testid="full-name-attribute" - name="config.ldap-full-name-attribute" + name="config.ldap-full-name-attribute[0]" ref={form.register} /> diff --git a/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapAttribute.tsx b/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapAttribute.tsx index af23e34e28..bc37819d48 100644 --- a/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapAttribute.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapAttribute.tsx @@ -33,7 +33,7 @@ export const LdapMapperHardcodedLdapAttribute = ({ type="text" id="kc-ldap-attribute-name" data-testid="ldap-attribute-name" - name="config.ldap-attribute-name" + name="config.ldap-attribute-name[0]" ref={form.register} /> @@ -54,7 +54,7 @@ export const LdapMapperHardcodedLdapAttribute = ({ type="text" id="kc-ldap-attribute-value" data-testid="ldap-attribute-value" - name="config.ldap-attribute-value" + name="config.ldap-attribute-value[0]" ref={form.register} /> diff --git a/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapGroup.tsx b/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapGroup.tsx index 15f3b76539..cd3b1b0353 100644 --- a/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapGroup.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapGroup.tsx @@ -33,7 +33,7 @@ export const LdapMapperHardcodedLdapGroup = ({ type="text" id="kc-group" data-testid="group" - name="config.group" + name="config.group[0]" ref={form.register} /> diff --git a/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapRole.tsx b/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapRole.tsx index e3999bc6c2..01e28df32b 100644 --- a/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapRole.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapRole.tsx @@ -33,7 +33,7 @@ export const LdapMapperHardcodedLdapRole = ({ type="text" id="kc-role" data-testid="role" - name="config.role" + name="config.role[0]" ref={form.register} /> diff --git a/src/user-federation/ldap/mappers/LdapMapperRoleGroup.tsx b/src/user-federation/ldap/mappers/LdapMapperRoleGroup.tsx index f8e437a74f..cceed5a7b4 100644 --- a/src/user-federation/ldap/mappers/LdapMapperRoleGroup.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperRoleGroup.tsx @@ -61,7 +61,7 @@ export const LdapMapperRoleGroup = ({ type="text" id="kc-ldap-dn" data-testid="ldap-dn" - name={isRole ? "config.roles-dn" : "config.groups-dn"} + name={isRole ? "config.roles-dn[0]" : "config.groups-dn[0]"} ref={form.register} /> @@ -77,7 +77,7 @@ export const LdapMapperRoleGroup = ({ : helpText("groupNameLdapAttributeHelp") } forLabel={ - isRole ? t("roleNameLdapAttribute") : t("roleNameLdapAttribute") + isRole ? t("roleNameLdapAttribute") : t("groupNameLdapAttribute") } forID="kc-name-attribute" /> @@ -92,8 +92,8 @@ export const LdapMapperRoleGroup = ({ data-testid="name-attribute" name={ isRole - ? "config.role-name-ldap-attribute" - : "config.group-name-ldap-attribute" + ? "config.role-name-ldap-attribute[0]" + : "config.group-name-ldap-attribute[0]" } ref={form.register} /> @@ -121,8 +121,8 @@ export const LdapMapperRoleGroup = ({ data-testid="object-classes" name={ isRole - ? "config.role-object-classes" - : "config.group-object-classes" + ? "config.role-object-classes[0]" + : "config.group-object-classes[0]" } ref={form.register} /> @@ -204,7 +204,7 @@ export const LdapMapperRoleGroup = ({ type="text" id="kc-membership-ldap-attribute" data-testid="membership-ldap-attribute" - name="config.membership-ldap-attribute" + name="config.membership-ldap-attribute[0]" ref={form.register} /> @@ -264,7 +264,7 @@ export const LdapMapperRoleGroup = ({ type="text" id="kc-membership-user-ldap-attribute" data-testid="membership-user-ldap-attribute" - name="config.membership-user-ldap-attribute" + name="config.membership-user-ldap-attribute[0]" ref={form.register} /> @@ -285,7 +285,11 @@ export const LdapMapperRoleGroup = ({ type="text" id="kc-ldap-filter" data-testid="ldap-filter" - name="config.ldap-filter" + name={ + isRole + ? "config.roles-ldap-filter[0]" + : "config.groups-ldap-filter[0]" + } ref={form.register} /> @@ -410,7 +414,7 @@ export const LdapMapperRoleGroup = ({ type="text" id="kc-member-of-attribute" data-testid="member-of-attribute" - name="config.memberof-ldap-attribute" + name="config.memberof-ldap-attribute[0]" ref={form.register} /> @@ -504,7 +508,7 @@ export const LdapMapperRoleGroup = ({ type="text" id="kc-mapped-attributes" data-testid="mapped-attributes" - name="config.mapped-group-attributes" + name="config.mapped-group-attributes[0]" ref={form.register} /> @@ -553,7 +557,7 @@ export const LdapMapperRoleGroup = ({ type="text" id="kc-path" data-testid="path" - name="config.groups-path" + name="config.groups-path[0]" ref={form.register} />