Bug 41572 - move python hook code into ImportUser class
move python hook code into ImportUser class
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.1 R2
Other Linux
: P5 normal (vote)
: UCS@school 4.1 R2 vXXX
Assigned To: Daniel Tröder
Florian Best
: interim-1
: 41576 (view as bug list)
Depends on:
Blocks: 42400 42541
  Show dependency treegraph
 
Reported: 2016-06-14 18:06 CEST by Daniel Tröder
Modified: 2016-10-06 11:51 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 1: Cosmetic issue or missing function but workaround exists
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.023
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2016-06-14 18:06:33 CEST
Currently the hooks are called from UserImport. That is fine as long as the Users are used within during an import job. But ImportUser should be usable solo like User.

Move python hook code into ImportUser class.
Comment 1 Daniel Tröder univentionstaff 2016-07-06 17:52:19 CEST
PyHooks are now part of the ImportUser class and are run from class_hooks() like in the lib.User class.

ImportStudent(name="a", firstname="a", lastname="a", school="schule1").create(lo)
→ PyHook pre_create
→ lib.hook pre_create
→ create_without_hooks()
→ PyHook post_create
→ lib.hook post_create

The order could be changed to look more symmetric, but I don't know of any reason...

code: 70858
advisory: 70859
Comment 2 Daniel Tröder univentionstaff 2016-07-06 17:59:27 CEST
PS: "import os": 70860 / 70861
Comment 3 Daniel Tröder univentionstaff 2016-07-22 12:05:09 CEST
Caching of PyHooks didn't work in the case of "no pyhooks". As a result a search for pyhooks was made for every new ImportUser object.

Fixed in r71191.
Comment 4 Daniel Tröder univentionstaff 2016-07-22 13:05:21 CEST
90_ucsschool.34_import-users_via_cli was failing, because LegacyImportUser.input_data was empty after A and M and thus the ucsschool.lib post-hooks couldn't work.

Fixed in r71199.
Comment 5 Daniel Tröder univentionstaff 2016-09-15 12:17:58 CEST
Moving of the PyHooks code to the lib User class was delayed until later, so this R2 be released. Moving code from ImportUser to User shouldn't be to problematic.
Comment 6 Florian Best univentionstaff 2016-09-19 14:31:12 CEST
OK: changes
Comment 7 Daniel Tröder univentionstaff 2016-09-19 14:41:38 CEST
r72665: added 90_ucsschool/112_import_user_pyhooks to test modifications on user objects by python import hooks
Comment 8 Sönke Schwardt-Krummrich univentionstaff 2016-10-04 13:24:45 CEST
UCS@school 4.1 R2 v5 has been released.

http://docs.software-univention.de/changelog-ucsschool-4.1R2v5-de.html

If this error occurs again, please clone this bug.
Comment 9 Sönke Schwardt-Krummrich univentionstaff 2016-10-06 11:51:16 CEST
*** Bug 41576 has been marked as a duplicate of this bug. ***