From bd6f8a9c7889475a2e31efe4a83b5cf6e9f1fac1 Mon Sep 17 00:00:00 2001 From: mfrances17 <39063664+mfrances17@users.noreply.github.com> Date: Fri, 14 May 2021 14:12:27 -0400 Subject: [PATCH] update default req values based on vendor (#578) --- .../ldap/LdapSettingsGeneral.tsx | 56 ++++++++++++++++++- .../ldap/LdapSettingsSearching.tsx | 5 ++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/src/user-federation/ldap/LdapSettingsGeneral.tsx b/src/user-federation/ldap/LdapSettingsGeneral.tsx index b3b3ac86ca..6bb6fecbc5 100644 --- a/src/user-federation/ldap/LdapSettingsGeneral.tsx +++ b/src/user-federation/ldap/LdapSettingsGeneral.tsx @@ -31,6 +31,58 @@ export const LdapSettingsGeneral = ({ const [isVendorDropdownOpen, setIsVendorDropdownOpen] = useState(false); + const setVendorDefaultValues = () => { + switch (form.getValues("config.vendor[0]")) { + case "ad": + form.setValue("config.usernameLDAPAttribute[0]", "cn"); + form.setValue("config.rdnLDAPAttribute[0]", "cn"); + form.setValue("config.uuidLDAPAttribute[0]", "objectGUID"); + form.setValue( + "config.userObjectClasses[0]", + "person, organizationalPerson, user" + ); + break; + case "rhds": + form.setValue("config.usernameLDAPAttribute[0]", "uid"); + form.setValue("config.rdnLDAPAttribute[0]", "uid"); + form.setValue("config.uuidLDAPAttribute[0]", "nsuniqueid"); + form.setValue( + "config.userObjectClasses[0]", + "inetOrgPerson, organizationalPerson" + ); + break; + case "tivoli": + form.setValue("config.usernameLDAPAttribute[0]", "uid"); + form.setValue("config.rdnLDAPAttribute[0]", "uid"); + form.setValue("config.uuidLDAPAttribute[0]", "uniqueidentifier"); + form.setValue( + "config.userObjectClasses[0]", + "inetOrgPerson, organizationalPerson" + ); + break; + case "edirectory": + form.setValue("config.usernameLDAPAttribute[0]", "uid"); + form.setValue("config.rdnLDAPAttribute[0]", "uid"); + form.setValue("config.uuidLDAPAttribute[0]", "guid"); + form.setValue( + "config.userObjectClasses[0]", + "inetOrgPerson, organizationalPerson" + ); + break; + case "other": + form.setValue("config.usernameLDAPAttribute[0]", "uid"); + form.setValue("config.rdnLDAPAttribute[0]", "uid"); + form.setValue("config.uuidLDAPAttribute[0]", "entryUUID"); + form.setValue( + "config.userObjectClasses[0]", + "inetOrgPerson, organizationalPerson" + ); + break; + default: + return ""; + } + }; + return ( <> {showSectionHeading && ( @@ -110,7 +162,7 @@ export const LdapSettingsGeneral = ({ > (