make dnAttributeName and uuidAttributeName configs optional
Signed-off-by: Kashish Mittal <kmittal@redhat.com>
This commit is contained in:
@@ -232,44 +232,44 @@ export class LdapClient {
|
||||
}
|
||||
this.vendor = this.getRootDSE()
|
||||
.then(root => {
|
||||
if (!vendorConfig) {
|
||||
if (root && root.raw?.forestFunctionality) {
|
||||
// ActiveDirectoryVendor
|
||||
return CreateLdapVendor(
|
||||
{
|
||||
dnAttributeName: 'distinguishedName',
|
||||
uuidAttributeName: 'objectGUID',
|
||||
},
|
||||
true,
|
||||
);
|
||||
} else if (root && root.raw?.ipaDomainLevel) {
|
||||
// FreeIpaVendor
|
||||
return CreateLdapVendor(
|
||||
{
|
||||
dnAttributeName: 'dn',
|
||||
uuidAttributeName: 'ipaUniqueID',
|
||||
},
|
||||
false,
|
||||
);
|
||||
} else if (root && 'aeRoot' in root.raw) {
|
||||
// AEDirVendor
|
||||
return CreateLdapVendor(
|
||||
{ dnAttributeName: 'dn', uuidAttributeName: 'entryUUID' },
|
||||
false,
|
||||
);
|
||||
}
|
||||
// DefaultLdapVendor
|
||||
if (root && root.raw?.forestFunctionality) {
|
||||
// ActiveDirectoryVendor
|
||||
return CreateLdapVendor(
|
||||
{
|
||||
dnAttributeName: 'entryDN',
|
||||
uuidAttributeName: 'entryUUID',
|
||||
dnAttributeName:
|
||||
vendorConfig?.dnAttributeName || 'distinguishedName',
|
||||
uuidAttributeName:
|
||||
vendorConfig?.uuidAttributeName || 'objectGUID',
|
||||
},
|
||||
!!(root && root.raw?.forestFunctionality),
|
||||
true,
|
||||
);
|
||||
} else if (root && root.raw?.ipaDomainLevel) {
|
||||
// FreeIpaVendor
|
||||
return CreateLdapVendor(
|
||||
{
|
||||
dnAttributeName: vendorConfig?.dnAttributeName || 'dn',
|
||||
uuidAttributeName:
|
||||
vendorConfig?.uuidAttributeName || 'ipaUniqueID',
|
||||
},
|
||||
false,
|
||||
);
|
||||
} else if (root && 'aeRoot' in root.raw) {
|
||||
// AEDirVendor
|
||||
return CreateLdapVendor(
|
||||
{
|
||||
dnAttributeName: vendorConfig?.dnAttributeName || 'dn',
|
||||
uuidAttributeName: vendorConfig?.uuidAttributeName || 'entryUUID',
|
||||
},
|
||||
false,
|
||||
);
|
||||
}
|
||||
// DefaultLdapVendor
|
||||
return CreateLdapVendor(
|
||||
vendorConfig,
|
||||
!!(root && root.raw?.forestFunctionality),
|
||||
{
|
||||
dnAttributeName: vendorConfig?.dnAttributeName,
|
||||
uuidAttributeName: vendorConfig?.uuidAttributeName,
|
||||
},
|
||||
false,
|
||||
);
|
||||
})
|
||||
.catch(err => {
|
||||
|
||||
@@ -177,12 +177,12 @@ export type VendorConfig = {
|
||||
/**
|
||||
* Attribute name for the distinguished name (DN) of an entry,
|
||||
*/
|
||||
dnAttributeName: string;
|
||||
dnAttributeName?: string;
|
||||
|
||||
/**
|
||||
* Attribute name for the unique identifier (UUID) of an entry,
|
||||
*/
|
||||
uuidAttributeName: string;
|
||||
uuidAttributeName?: string;
|
||||
};
|
||||
|
||||
const defaultUserConfig = {
|
||||
@@ -256,8 +256,8 @@ function readVendorConfig(
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
dnAttributeName: c.getString('dnAttributeName'),
|
||||
uuidAttributeName: c.getString('uuidAttributeName'),
|
||||
dnAttributeName: c.getOptionalString('dnAttributeName'),
|
||||
uuidAttributeName: c.getOptionalString('uuidAttributeName'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ export const CreateLdapVendor = (
|
||||
isActiveDirectoryVendor: boolean,
|
||||
): LdapVendor => {
|
||||
return {
|
||||
dnAttributeName: vendorConfig.dnAttributeName,
|
||||
uuidAttributeName: vendorConfig.uuidAttributeName,
|
||||
dnAttributeName: vendorConfig.dnAttributeName || `entryDN`,
|
||||
uuidAttributeName: vendorConfig.uuidAttributeName || `entryUUID`,
|
||||
decodeStringAttribute: (entry, name) => {
|
||||
const decoder = (value: string | Buffer) => {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user