update default req values based on vendor (#578)
This commit is contained in:
parent
40d004cdf1
commit
bd6f8a9c78
2 changed files with 59 additions and 2 deletions
|
@ -31,6 +31,58 @@ export const LdapSettingsGeneral = ({
|
||||||
|
|
||||||
const [isVendorDropdownOpen, setIsVendorDropdownOpen] = useState(false);
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
{showSectionHeading && (
|
{showSectionHeading && (
|
||||||
|
@ -110,7 +162,7 @@ export const LdapSettingsGeneral = ({
|
||||||
>
|
>
|
||||||
<Controller
|
<Controller
|
||||||
name="config.vendor[0]"
|
name="config.vendor[0]"
|
||||||
defaultValue=""
|
defaultValue="ad"
|
||||||
control={form.control}
|
control={form.control}
|
||||||
render={({ onChange, value }) => (
|
render={({ onChange, value }) => (
|
||||||
<Select
|
<Select
|
||||||
|
@ -121,10 +173,10 @@ export const LdapSettingsGeneral = ({
|
||||||
onSelect={(_, value) => {
|
onSelect={(_, value) => {
|
||||||
onChange(value as string);
|
onChange(value as string);
|
||||||
setIsVendorDropdownOpen(false);
|
setIsVendorDropdownOpen(false);
|
||||||
|
setVendorDefaultValues();
|
||||||
}}
|
}}
|
||||||
selections={value}
|
selections={value}
|
||||||
variant={SelectVariant.single}
|
variant={SelectVariant.single}
|
||||||
// data-testid="ldap-vendor"
|
|
||||||
>
|
>
|
||||||
<SelectOption key={0} value="ad" isPlaceholder>
|
<SelectOption key={0} value="ad" isPlaceholder>
|
||||||
Active Directory
|
Active Directory
|
||||||
|
|
|
@ -96,6 +96,7 @@ export const LdapSettingsSearching = ({
|
||||||
<TextInput
|
<TextInput
|
||||||
isRequired
|
isRequired
|
||||||
type="text"
|
type="text"
|
||||||
|
defaultValue=""
|
||||||
id="kc-console-users-dn"
|
id="kc-console-users-dn"
|
||||||
data-testid="ldap-users-dn"
|
data-testid="ldap-users-dn"
|
||||||
name="config.usersDn[0]"
|
name="config.usersDn[0]"
|
||||||
|
@ -129,6 +130,7 @@ export const LdapSettingsSearching = ({
|
||||||
<TextInput
|
<TextInput
|
||||||
isRequired
|
isRequired
|
||||||
type="text"
|
type="text"
|
||||||
|
defaultValue="cn"
|
||||||
id="kc-username-ldap-attribute"
|
id="kc-username-ldap-attribute"
|
||||||
data-testid="ldap-username-attribute"
|
data-testid="ldap-username-attribute"
|
||||||
name="config.usernameLDAPAttribute[0]"
|
name="config.usernameLDAPAttribute[0]"
|
||||||
|
@ -162,6 +164,7 @@ export const LdapSettingsSearching = ({
|
||||||
<TextInput
|
<TextInput
|
||||||
isRequired
|
isRequired
|
||||||
type="text"
|
type="text"
|
||||||
|
defaultValue="cn"
|
||||||
id="kc-rdn-ldap-attribute"
|
id="kc-rdn-ldap-attribute"
|
||||||
data-testid="ldap-rdn-attribute"
|
data-testid="ldap-rdn-attribute"
|
||||||
name="config.rdnLDAPAttribute[0]"
|
name="config.rdnLDAPAttribute[0]"
|
||||||
|
@ -195,6 +198,7 @@ export const LdapSettingsSearching = ({
|
||||||
<TextInput
|
<TextInput
|
||||||
isRequired
|
isRequired
|
||||||
type="text"
|
type="text"
|
||||||
|
defaultValue="objectGUID"
|
||||||
id="kc-uuid-ldap-attribute"
|
id="kc-uuid-ldap-attribute"
|
||||||
data-testid="ldap-uuid-attribute"
|
data-testid="ldap-uuid-attribute"
|
||||||
name="config.uuidLDAPAttribute[0]"
|
name="config.uuidLDAPAttribute[0]"
|
||||||
|
@ -228,6 +232,7 @@ export const LdapSettingsSearching = ({
|
||||||
<TextInput
|
<TextInput
|
||||||
isRequired
|
isRequired
|
||||||
type="text"
|
type="text"
|
||||||
|
defaultValue="person, organizationalPerson, user"
|
||||||
id="kc-user-object-classes"
|
id="kc-user-object-classes"
|
||||||
data-testid="ldap-user-object-classes"
|
data-testid="ldap-user-object-classes"
|
||||||
name="config.userObjectClasses[0]"
|
name="config.userObjectClasses[0]"
|
||||||
|
|
Loading…
Reference in a new issue