Univention Bugzilla – Bug 57599
can't change workgroups when modifying users through the csv import
Last modified: 2024-09-17 08:57:25 CEST
Bug #54891 completely removed the ability to change a user's workgroups when modifying them using the csv import, as the workgroup attribute will always get overwritten by the old value: --- ucs-school-import/modules/ucsschool/importer/models/import_user.py +++ ucs-school-import/modules/ucsschool/importer/models/import_user.py @@ -1092,10 +1092,14 @@ class ImportUser(User): def modify_without_hooks(self, lo, validate=True, move_if_necessary=None): # type: (LoType, Optional[bool], Optional[bool]) -> bool + # preserve workgroups during import + # always getting the UDM object shouldn't have a big impact on performance since it will be retrieved anyway + # and it is cached + udm_obj = self.get_udm_object(lo) + self.workgroups = self.get_workgroups(udm_obj, self)
Thanks for your report! Can you explain a bit more what you mean with "the ability to change a user's workgroups" - Via a hook or something else? If you mean via a hook it would be great to state what you have tried so far: Was this limited to the pre_{create,modify} stages or also during post_{create,modify}?
Well actually, I'm trying to read user's workgroups from the import CSV file and set them using a custom CSVReader class (so technically no hook). I'd assume that the modify_without_hooks function gets used by the csv reader and all hook stages which modify (not create) users, though I haven't tested that.