Univention Bugzilla – Bug 45679
school import with unique email address changes email address every import
Last modified: 2017-12-21 12:22:59 CET
When a UCS@school import is configured with 1. no key for email in csv:mapping 2. "[ALWAYSCOUNTER]" or "[COUNTER2]" in scheme:email the email address of a already imported user will be changed in every import job. This happens because in UserImport.determine_add_modify_action() all attributes of the freshly read ImportUser are first calculated with ImportUser.prepare_all() and those are then used to update the values read from the same user from LDAP. If the "email" attribute of a freshly read ImportUser is empty, it will be generated from csv:schema:email, resulting in the same email address as before, but with a raised counter number. The hotfix for a customer will copy the value of the email attribute from the LDAP user to the freshly read ImportUser and this prevent the creation of new email address. For the product the solution will be more complicated: To automatically modify the email address if either the schema changes or the input data (e.g. lastname), a compare operation is required that can simulate creating the email address from schema but ignore the counter digits. If the simulation determines that the email address would be different with the current data and configuration, a new email address will be generated.
A UCRV should switch the feature "schema or input data change modifies user" on or off. Default=on. This UCRV must be documented in the import CLI documentation with an appropriate warning about changing the schema.
The new UCRV ucsschool/import/generate/user/attributes/no-overwrite is a whitespace separated list of LDAP attributes that the user import will not overwrite when their values are non-empty Default when unset: "homeShare homeSharePath mailHomeServer mailPrimaryAddress password profilepath sambahome uidNumber unixhome username" The test 90_ucsschool/226_import-users_no-overwrite-attributes was added that checks if the feature works. A lot of tests were modified, as apparently ImportUser._prevent_mapped_attributes_in_udm_properties() was not working before. a05f5206: attributes listed in UCRV ucsschool/import/generate/user/attributes/no-overwrite will not be overwritten c4060e48: adapt tests to fixed attribute detection a30d0310: add test to check no-overwrite attributes 88be06c1: advisory ucs-school-import 15.0.3-9A~4.2.0.201711241613 ucs-test-ucsschool 4.0.4-42A~4.2.0.201711241615
Did some small changes to UCR variable description. ucs-school-import (15.0.3-16): 2f438af4b1b2 | Bug #45679: add changelog entry 30c30f4a3399 | Bug #45679: updated UCR variable description Package: ucs-school-import Version: 15.0.3-16A~4.2.0.201712090040 Branch: ucs_4.2-0 Scope: ucs-school-4.2 OK: code change OK: functional test UCRV .../no-overwrite="" UCRV .../no-overwrite="description" UCRV .../no-overwrite="description mailPrimaryAddress" UCRV .../no-overwrite="mailPrimaryAddress" OK: ucs-test 226_* OK: advisory
The UCRV ucsschool/import/generate/user/attributes/no-overwrite and its logic/code have been removed/reverted and the UCRV ucsschool/import/generate/user/attributes/no-overwrite-by-schema with a default of "mailPrimaryAddress uid" added instead. An attributes value will now not be overwritten if it already exists and would be created from a schema. Input from CSV will _always_ overwrite values. commit 4ed5e1eda55a404c8cd8dd83b57b85169d86d159 Bug #45679: prevent overwriting of attribute values by schema with new UCRV commit 792b23bd8faeae496fd5fcf6c966143555882639 Bug #45679: adapt test commit ba765f55ffda88bf1b4fb31689fbb488b009f7d6 Bug #45679: changelogs, advisory commit a49c123e0b114f9d5ccb59c4932194a287a8712f Bug #45679: advisory update ucs-school-import (15.0.3-20) ucs-test-ucsschool (4.0.4-51)
OK: after a second import the mailPrimaryAddress did not change OK: Code review (looks like an API change if you implemented make_* functions on your own) OK: YAML / Changelog
UCS@school 4.2 v6 has been released. http://docs.software-univention.de/changelog-ucsschool-4.2v6-de.html If this error occurs again, please clone this bug.