commit 8b240f70fa7fe43fab684c783b92642118c54960 Author: Florian Best Date: Thu Aug 19 13:13:46 2021 +0200 Bug #53674: add UDM hook _ldap_{pre,post}_rename diff --git management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py index 6adf6ebfc2..a42e9627f2 100644 --- management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py +++ management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py @@ -1351,9 +1351,11 @@ class simpleLdap(object): try: self.dn = self.lo.modify(self.dn, ml, ignore_license=ignore_license, serverctrls=serverctrls, response=response, rename_callback=wouldRename.on_rename) except wouldRename as exc: + self.call_udm_property_hook('hook_ldap_pre_rename', self) self._ldap_pre_rename(exc.args[1]) self.dn = self.lo.modify(self.dn, ml, ignore_license=ignore_license, serverctrls=serverctrls, response=response) self._ldap_post_rename(exc.args[1]) + self.call_udm_property_hook('hook_ldap_post_rename', self) if ml: self._write_admin_diary_modify() diff --git management/univention-directory-manager-modules/modules/univention/admin/hook.py management/univention-directory-manager-modules/modules/univention/admin/hook.py index 764b5a176c..b9c17bb64d 100644 --- management/univention-directory-manager-modules/modules/univention/admin/hook.py +++ management/univention-directory-manager-modules/modules/univention/admin/hook.py @@ -172,6 +172,24 @@ class simpleHook(object): """ ud.debug(ud.ADMIN, ud.INFO, 'admin.syntax.hook.simpleHook: _ldap_post_remove called') + def hook_ldap_pre_rename(self, obj): + # type: (univention.admin.handlers.simpleLdap) -> None + """ + This method is called before an |UDM| object is renamed. + + :param obj: The |UDM| object instance. + """ + ud.debug(ud.ADMIN, ud.INFO, 'admin.syntax.hook.simpleHook: _ldap_pre_rename called') + + def hook_ldap_post_rename(self, obj): + # type: (univention.admin.handlers.simpleLdap) -> None + """ + This method is called after the object was renamed from |LDAP|. + + :param obj: The |UDM| object instance. + """ + ud.debug(ud.ADMIN, ud.INFO, 'admin.syntax.hook.simpleHook: _ldap_post_rename called') + class AttributeHook(simpleHook): """