Add editMode as a required field (#1209)
This commit is contained in:
parent
bef9539389
commit
453b5a07e7
5 changed files with 30 additions and 6 deletions
|
@ -29,6 +29,7 @@ const firstBindType = "simple";
|
||||||
const firstBindDn = "user-1";
|
const firstBindDn = "user-1";
|
||||||
const firstBindCreds = "password1";
|
const firstBindCreds = "password1";
|
||||||
|
|
||||||
|
const firstEditMode = "READ_ONLY";
|
||||||
const firstUsersDn = "user-dn-1";
|
const firstUsersDn = "user-dn-1";
|
||||||
const firstUserLdapAtt = "uid";
|
const firstUserLdapAtt = "uid";
|
||||||
const firstRdnLdapAtt = "uid";
|
const firstRdnLdapAtt = "uid";
|
||||||
|
@ -102,6 +103,7 @@ describe("User Fed LDAP mapper tests", () => {
|
||||||
firstBindCreds
|
firstBindCreds
|
||||||
);
|
);
|
||||||
providersPage.fillLdapRequiredSearchingData(
|
providersPage.fillLdapRequiredSearchingData(
|
||||||
|
firstEditMode,
|
||||||
firstUsersDn,
|
firstUsersDn,
|
||||||
firstUserLdapAtt,
|
firstUserLdapAtt,
|
||||||
firstRdnLdapAtt,
|
firstRdnLdapAtt,
|
||||||
|
|
|
@ -22,6 +22,7 @@ const firstBindType = "simple";
|
||||||
const firstBindDn = "user-1";
|
const firstBindDn = "user-1";
|
||||||
const firstBindCreds = "password1";
|
const firstBindCreds = "password1";
|
||||||
|
|
||||||
|
const firstEditMode = "READ_ONLY";
|
||||||
const firstUsersDn = "user-dn-1";
|
const firstUsersDn = "user-dn-1";
|
||||||
const firstUserLdapAtt = "uid";
|
const firstUserLdapAtt = "uid";
|
||||||
const firstRdnLdapAtt = "uid";
|
const firstRdnLdapAtt = "uid";
|
||||||
|
@ -33,6 +34,7 @@ const secondLdapVendor = "Other";
|
||||||
|
|
||||||
const secondBindType = "none";
|
const secondBindType = "none";
|
||||||
|
|
||||||
|
const secondEditMode = "WRITABLE";
|
||||||
const secondUsersDn = "user-dn-2";
|
const secondUsersDn = "user-dn-2";
|
||||||
const secondUserLdapAtt = "cn";
|
const secondUserLdapAtt = "cn";
|
||||||
const secondRdnLdapAtt = "cn";
|
const secondRdnLdapAtt = "cn";
|
||||||
|
@ -80,6 +82,7 @@ describe("User Fed LDAP tests", () => {
|
||||||
firstBindCreds
|
firstBindCreds
|
||||||
);
|
);
|
||||||
providersPage.fillLdapRequiredSearchingData(
|
providersPage.fillLdapRequiredSearchingData(
|
||||||
|
firstEditMode,
|
||||||
firstUsersDn,
|
firstUsersDn,
|
||||||
firstUserLdapAtt,
|
firstUserLdapAtt,
|
||||||
firstRdnLdapAtt,
|
firstRdnLdapAtt,
|
||||||
|
@ -162,6 +165,7 @@ describe("User Fed LDAP tests", () => {
|
||||||
providersPage.fillLdapRequiredGeneralData(secondLdapName, secondLdapVendor);
|
providersPage.fillLdapRequiredGeneralData(secondLdapName, secondLdapVendor);
|
||||||
providersPage.fillLdapRequiredConnectionData(connectionUrl, secondBindType);
|
providersPage.fillLdapRequiredConnectionData(connectionUrl, secondBindType);
|
||||||
providersPage.fillLdapRequiredSearchingData(
|
providersPage.fillLdapRequiredSearchingData(
|
||||||
|
secondEditMode,
|
||||||
secondUsersDn,
|
secondUsersDn,
|
||||||
secondUserLdapAtt,
|
secondUserLdapAtt,
|
||||||
secondRdnLdapAtt,
|
secondRdnLdapAtt,
|
||||||
|
|
|
@ -18,6 +18,8 @@ export default class ProviderPage {
|
||||||
private ldapBindCredsInput = "data-testid=ldap-bind-credentials";
|
private ldapBindCredsInput = "data-testid=ldap-bind-credentials";
|
||||||
|
|
||||||
// LdapSettingsSearching required input values
|
// LdapSettingsSearching required input values
|
||||||
|
private ldapEditModeInput = "#kc-edit-mode";
|
||||||
|
private ldapEditModeList = "#kc-edit-mode + ul";
|
||||||
private ldapUsersDnInput = "data-testid=ldap-users-dn";
|
private ldapUsersDnInput = "data-testid=ldap-users-dn";
|
||||||
private ldapUserLdapAttInput = "data-testid=ldap-username-attribute";
|
private ldapUserLdapAttInput = "data-testid=ldap-username-attribute";
|
||||||
private ldapRdnLdapAttInput = "data-testid=ldap-rdn-attribute";
|
private ldapRdnLdapAttInput = "data-testid=ldap-rdn-attribute";
|
||||||
|
@ -167,12 +169,18 @@ export default class ProviderPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
fillLdapRequiredSearchingData(
|
fillLdapRequiredSearchingData(
|
||||||
|
editMode: string,
|
||||||
usersDn: string,
|
usersDn: string,
|
||||||
userLdapAtt: string,
|
userLdapAtt: string,
|
||||||
rdnLdapAtt: string,
|
rdnLdapAtt: string,
|
||||||
uuidLdapAtt: string,
|
uuidLdapAtt: string,
|
||||||
userObjClasses: string
|
userObjClasses: string
|
||||||
) {
|
) {
|
||||||
|
if (editMode) {
|
||||||
|
cy.get(this.ldapEditModeInput).click();
|
||||||
|
cy.get(this.ldapEditModeList).contains(editMode).click();
|
||||||
|
}
|
||||||
|
|
||||||
if (usersDn) {
|
if (usersDn) {
|
||||||
cy.get(`[${this.ldapUsersDnInput}]`).type(usersDn);
|
cy.get(`[${this.ldapUsersDnInput}]`).type(usersDn);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,11 +52,15 @@ export const LdapSettingsSearching = ({
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
fieldId="kc-edit-mode"
|
fieldId="kc-edit-mode"
|
||||||
|
isRequired
|
||||||
>
|
>
|
||||||
<Controller
|
<Controller
|
||||||
name="config.editMode[0]"
|
name="config.editMode[0]"
|
||||||
defaultValue=""
|
defaultValue=""
|
||||||
control={form.control}
|
control={form.control}
|
||||||
|
rules={{
|
||||||
|
required: { value: true, message: t("validateEditMode") },
|
||||||
|
}}
|
||||||
render={({ onChange, value }) => (
|
render={({ onChange, value }) => (
|
||||||
<Select
|
<Select
|
||||||
toggleId="kc-edit-mode"
|
toggleId="kc-edit-mode"
|
||||||
|
@ -66,19 +70,24 @@ export const LdapSettingsSearching = ({
|
||||||
}
|
}
|
||||||
isOpen={isEditModeDropdownOpen}
|
isOpen={isEditModeDropdownOpen}
|
||||||
onSelect={(_, value) => {
|
onSelect={(_, value) => {
|
||||||
onChange(value as string);
|
onChange(value.toString());
|
||||||
setIsEditModeDropdownOpen(false);
|
setIsEditModeDropdownOpen(false);
|
||||||
}}
|
}}
|
||||||
selections={value}
|
selections={value}
|
||||||
variant={SelectVariant.single}
|
variant={SelectVariant.single}
|
||||||
>
|
>
|
||||||
<SelectOption key={0} value="" isPlaceholder />
|
<SelectOption value="" isPlaceholder />
|
||||||
<SelectOption key={1} value="READ_ONLY" />
|
<SelectOption value="READ_ONLY" />
|
||||||
<SelectOption key={2} value="WRITABLE" />
|
<SelectOption value="WRITABLE" />
|
||||||
<SelectOption key={3} value="UNSYNCED" />
|
<SelectOption value="UNSYNCED" />
|
||||||
</Select>
|
</Select>
|
||||||
)}
|
)}
|
||||||
></Controller>
|
/>
|
||||||
|
{form.errors.config?.editMode?.[0] && (
|
||||||
|
<div className="error">
|
||||||
|
{form.errors.config.editMode[0].message}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={t("usersDN")}
|
label={t("usersDN")}
|
||||||
|
|
|
@ -127,6 +127,7 @@ export default {
|
||||||
validateBindCredentials: "You must enter the password of the LDAP admin",
|
validateBindCredentials: "You must enter the password of the LDAP admin",
|
||||||
validateUuidLDAPAttribute: "You must enter a UUID LDAP attribute",
|
validateUuidLDAPAttribute: "You must enter a UUID LDAP attribute",
|
||||||
validateUserObjectClasses: "You must enter one or more user object classes",
|
validateUserObjectClasses: "You must enter one or more user object classes",
|
||||||
|
validateEditMode: "You must select an edit mode",
|
||||||
validateUsersDn: "You must enter users DN",
|
validateUsersDn: "You must enter users DN",
|
||||||
validateUsernameLDAPAttribute: "You must enter a username LDAP attribute",
|
validateUsernameLDAPAttribute: "You must enter a username LDAP attribute",
|
||||||
validateRdnLdapAttribute: "You must enter an RDN LDAP attribute",
|
validateRdnLdapAttribute: "You must enter an RDN LDAP attribute",
|
||||||
|
|
Loading…
Reference in a new issue