Bug 45679 - school import with unique email address changes email address every import
school import with unique email address changes email address every import
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.2
Other Linux
: P5 normal (vote)
: UCS@school 4.2 v6
Assigned To: Daniel Tröder
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-11-09 11:59 CET by Daniel Tröder
Modified: 2017-12-21 12:22 CET (History)
4 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 5: Blocking further progress on the daily work
User Pain: 0.286
Enterprise Customer affected?:
School Customer affected?: Yes
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 2017-11-09 11:59:30 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.
Comment 2 Daniel Tröder univentionstaff 2017-11-09 18:22:12 CET
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.
Comment 3 Daniel Tröder univentionstaff 2017-11-24 16:19:19 CET
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
Comment 4 Sönke Schwardt-Krummrich univentionstaff 2017-12-09 00:51:58 CET
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
Comment 5 Daniel Tröder univentionstaff 2017-12-18 12:40:30 CET
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)
Comment 6 Florian Best univentionstaff 2017-12-19 14:01:32 CET
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
Comment 7 Sönke Schwardt-Krummrich univentionstaff 2017-12-21 12:22:59 CET
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.