Univention Bugzilla – Bug 41576
ucsschool-import: remove hook functions in UserImport
Last modified: 2023-03-25 06:40:30 CET
The hook functions directly within the UserImport class (ucs-school-import/modules/ucsschool/importer/mass_import/user_import.py) are not that flexible as expected. The PyHooks cover the same benefits and are much more flexible (stackable, other packages can install hooks without subclassing existing files). +++ This bug was initially created as a clone of Bug #41354 +++ The UserImport object has a "connection" attribute. It is documented in the docstring: def create_and_modify_hook(self, user, hook_time): """ Run code before or after creating or modifying a user. IMPLEMENT ME if you want to use a hook. You'll have full access to the data being saved to LDAP. It is much faster than running executables from /usr/share/ucs-school-import/hooks/*. * See user.action to know which action it is ("A" or "M"). * With action=A, if hook_time=pre the ImportUser does not exist in LDAP, yet. user.dn will be None. If hook_time=post user will be a opened ImportUser, loaded from LDAP. * With action=M, user is always a opened ImportUser, loaded from LDAP. * Use self.connection if you need a LDAP connection. :param user: ImportUser :param hook_time: str: either "pre" or "post" :return: None """ pass def delete_hook(self, user, hook_time): """ Run code before or after deleting a user. IMPLEMENT ME if you want to use a hook. You'll have full access to the data being saved to LDAP. It is much faster than running executables from /usr/share/ucs-school-import/hooks/*. * user is a opened ImportUser, loaded from LDAP. * Use self.connection if you need a LDAP connection. :param user: ImportUser :param hook_time: str: either "pre" or "post" :return: None """ pass
The hook functions in UserImport class are deprecated and will be removed soon!
Functions have already been renamed in 41354 and removed/refactored via 41572. *** This bug has been marked as a duplicate of bug 41572 ***