Bug 42130 - (4.1r2) Feature request: Increase handling of scheme:email options during import of user
(4.1r2) Feature request: Increase handling of scheme:email options during imp...
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 v14
Assigned To: Daniel Tröder
Florian Best
:
Depends on:
Blocks: 44993 45506
  Show dependency treegraph
 
Reported: 2016-08-25 15:43 CEST by Michel Smidt
Modified: 2017-10-16 21:33 CEST (History)
5 users (show)

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Usability
Max CVSS v3 score:
best: Patch_Available+


Attachments
Traceback of import (850 bytes, text/plain)
2016-08-25 15:43 CEST, Michel Smidt
Details
username = name (599 bytes, patch)
2016-08-26 08:06 CEST, Daniel Tröder
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Smidt 2016-08-25 15:43:21 CEST
Created attachment 7923 [details]
Traceback of import

According to Feedback on Ticket#2016082421000167 related to the Import-Interface.

Use case from the customer:
Import user with an unique email.

Procedure:
The customer tried two different import configurations for the option scheme:email and didn't get the expected results:
1. "email": "<firstname>.<lastname>[COUNTER2]@<maildomain>" and
2. "email": "<username>@<maildomain>"

The first approach doesn't fail but the String "[COUNTER2]" was added to the email address which wasn't the goal.
The second approach failed with (Traceback 1 attached):
ERROR user_import.create_and_modify_users:189  Entry #2: Email address '@schulen.de' has invalid format. 

Following configuration works:
"email": "<name>@<maildomain>"
Leads to lmustermann20@schulen.de
I think its because the name of attribute from the the underlying ucs-school-lib UCS@school-User is "name".

So, from my perspective a quick workaround would be the documentation of "email": "<name>@<maildomain>" and later on the implementation of both configuration options.

1. "email": "<firstname>.<lastname>[COUNTER2]@<maildomain>"
A generic possibility to use the counters.

2. "email": "<username>@<maildomain>"
Static mapping from the keywords "username" & "uid" to "email": "<name>@<maildomain>"
Comment 1 Daniel Tröder univentionstaff 2016-08-26 08:06:01 CEST
Created attachment 7925 [details]
username = name

Patch to make "username" available as formatting variable.

I wouldn't like to add "uid" as an alias for username, as IMHO it is to easily confused with uidNumber.
Comment 2 Daniel Tröder univentionstaff 2016-08-26 08:22:28 CEST
Regarding [COUNTER] variables in other properties than username:

It would be trivial to generalize ucsschool.importer.utils.username_handler.UsernameHandler to format arbitrary properties.

Changes necessary:
* ldap schema change: add a field for the property name
* ldap queries: use property name as additional parameter
* rename variables to reflect generalization ;)

Please be aware, that one object per user and property is stored in cn=unique-usernames,cn=ucsschool,cn=univention,$ldap_base. So for 50,000 users with [COUNTER] variables in username and email, you'll have 100,000 ldap objects. This is not a problem as they are very small and indexed - just mentioning.
Comment 3 Daniel Tröder univentionstaff 2017-09-08 10:41:01 CEST
* cherry-picked commits from Bug #44993 into branch dtroeder/42130_email_counter
* merged into branch 4.1r2 with commit 3247792d67ab5672810bd49bb1bf54edc763628f

Unfortunately I forget to add "Bug #42130" to all commit messages.

Package: ucs-school-import
Version: 14.0.16-47.338.201709081035
Branch: ucs_4.1-0
Scope: ucs-school-4.1r2

Package: ucs-test-ucsschool
Version: 3.0.17-65.383.201709081035
Branch: ucs_4.1-0
Scope: ucs-school-4.1r2

advisory: 12f7d8f031f402a4c229b0d96844a04788215ad4
Comment 4 Florian Best univentionstaff 2017-09-15 12:36:38 CEST
The following tests are failing:
 90_ucsschool.207_import-users_school_change.test
 90_ucsschool.213_import-users_modify_with_several_groups.test
 90_ucsschool.216_import-users_delete_variants.test
Comment 5 Daniel Tröder univentionstaff 2017-10-11 17:21:51 CEST
(In reply to Florian Best from comment #4)
> The following tests are failing:
>  90_ucsschool.207_import-users_school_change.test
Unrelated, and was failing before.

>  90_ucsschool.213_import-users_modify_with_several_groups.test
Unrelated. The test seems to be mostly stable.

>  90_ucsschool.216_import-users_delete_variants.test
Fails because of Bug #41574. Fixed (kind of) in d4edbca4.
Comment 6 Florian Best univentionstaff 2017-10-12 15:19:34 CEST
(In reply to Daniel Tröder from comment #5)
> (In reply to Florian Best from comment #4)
> > The following tests are failing:
> >  90_ucsschool.207_import-users_school_change.test
> Unrelated, and was failing before.
OK → Bug #44310

> >  90_ucsschool.213_import-users_modify_with_several_groups.test
> Unrelated. The test seems to be mostly stable.
OK.

> >  90_ucsschool.216_import-users_delete_variants.test
> Fails because of Bug #41574. Fixed (kind of) in d4edbca4.
OK, looks legit.
Comment 7 Sönke Schwardt-Krummrich univentionstaff 2017-10-16 21:33:06 CEST
UCS@school 4.1 R2 v14 has been released.

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

If this error occurs again, please clone this bug.