mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-02 13:44:39 +00:00
feat(ingest): Add advanced configuration for LDAP manager ingestion (#7784)
Co-authored-by: Harshal Sheth <hsheth2@gmail.com>
This commit is contained in:
parent
5d3c6a8a00
commit
294857ab8d
@ -128,6 +128,16 @@ class LDAPSourceConfig(StatefulIngestionConfigBase, DatasetSourceConfigMixin):
|
||||
default=20, description="Size of each page to fetch when extracting metadata."
|
||||
)
|
||||
|
||||
manager_filter_enabled: bool = Field(
|
||||
default=True,
|
||||
description="Use LDAP extractor filter to search managers.",
|
||||
)
|
||||
|
||||
manager_pagination_enabled: bool = Field(
|
||||
default=True,
|
||||
description="Use pagination while search for managers (enabled by default).",
|
||||
)
|
||||
|
||||
# default mapping for attrs
|
||||
user_attrs_map: Dict[str, Any] = {}
|
||||
group_attrs_map: Dict[str, Any] = {}
|
||||
@ -286,11 +296,19 @@ class LDAPSource(StatefulIngestionSourceBase):
|
||||
if self.config.user_attrs_map["managerUrn"] in attrs:
|
||||
try:
|
||||
m_cn = attrs[self.config.user_attrs_map["managerUrn"]][0].decode()
|
||||
if self.config.manager_filter_enabled:
|
||||
manager_filter = self.config.filter
|
||||
else:
|
||||
manager_filter = None
|
||||
if self.config.manager_pagination_enabled:
|
||||
ctrls = [self.lc]
|
||||
else:
|
||||
ctrls = None
|
||||
manager_msgid = self.ldap_client.search_ext(
|
||||
m_cn,
|
||||
ldap.SCOPE_BASE,
|
||||
self.config.filter,
|
||||
serverctrls=[self.lc],
|
||||
manager_filter,
|
||||
serverctrls=ctrls,
|
||||
)
|
||||
result = self.ldap_client.result3(manager_msgid)
|
||||
if result[1]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user