From f588b19ad3c16b98650289145e1ad06baad45de6 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Fri, 30 Sep 2022 16:47:37 +0200 Subject: [PATCH] Adding possibility to give a separate LDAP connection --- lib/pp_admintools/app/ldap.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/pp_admintools/app/ldap.py b/lib/pp_admintools/app/ldap.py index d57d922..e313175 100644 --- a/lib/pp_admintools/app/ldap.py +++ b/lib/pp_admintools/app/ldap.py @@ -50,7 +50,7 @@ from ..config.ldap import LdapConnectionInfo, LdapConfiguration # rom ..config.ldap import DEFAULT_PORT_LDAP, DEFAULT_PORT_LDAPS from ..config.ldap import DEFAULT_TIMEOUT -__version__ = '0.7.3' +__version__ = '0.7.4' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -991,10 +991,11 @@ class BaseLdapApplication(BaseDPXApplication): return attribs # ------------------------------------------------------------------------- - def modify_entry(self, inst, dn, changes): + def modify_entry(self, inst, dn, changes, ldap=None): connect_info = self.cfg.ldap_connection[inst] - ldap = self.ldap_connection[inst] + if not ldap: + ldap = self.ldap_connection[inst] # connect_info = self.cfg.ldap_connection[inst] if self.verbose > 1: @@ -1035,10 +1036,11 @@ class BaseLdapApplication(BaseDPXApplication): return True # ------------------------------------------------------------------------- - def delete_entry(self, inst, dn): + def delete_entry(self, inst, dn, ldap=None): connect_info = self.cfg.ldap_connection[inst] - ldap = self.ldap_connection[inst] + if not ldap: + ldap = self.ldap_connection[inst] msg = _("Deleting LDAP entry {dn!r} on {uri} ...").format( uri=connect_info.url, dn=dn) -- 2.39.5