Bug 51664 - seed unique-usernames (unique-emails) database with existing usernames (emails)
seed unique-usernames (unique-emails) database with existing usernames (emails)
Status: NEW
Product: UCS@school
Classification: Unclassified
Component: Import scripts
unspecified
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS@school maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-07-13 11:51 CEST by Daniel Tröder
Modified: 2023-09-08 10:35 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Development Internal
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: 2020070721000139
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 2020-07-13 11:51:54 CEST
Add a script to the UCS@school import package that finds existing usernames and email addresses, calculates their name base (if they already have trailing digits) and creates/raises unique-username / unique-email objects in LDAP.

The script must feature
* a dry-run,
* allow choosing to add/update only usernames, only emails or both and
* a mode to add/raise only names that match a given pattern.
Comment 1 Christina Scheinig univentionstaff 2020-07-13 12:02:52 CEST
This would decrease some support effort. Because missing counters cause the import to fail, with e.g. 

2020-07-06 17:59:00 ERROR user_import.create_and_modify_users:212  Entry #0: ValidationError when adding ImportStudent(name='cscheini2', school=u'sun', dn=u'uid=cscheini2,cn=schueler,cn=users,ou=sun,dc=schein,dc=me', old_dn=None) (source_uid:sun-student record_uid: 707005-3756): {'email': ['The email address is already taken by
 another user. Please change the email address.']} ValidationError({'email': ['The email address is already taken by another user. Please change the email address.']},)
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/user_import.py", line 179, in create_and_modify_users
    success = user.create(lo=self.connection)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 321, in create
    res = super(ImportUser, self).create(lo, validate)
  File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 478, in create
    success = self.create_without_hooks(lo, validate)
  File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 493, in create_without_hooks
    raise ValidationError(self.errors.copy())
UserValidationError: ValidationError when adding ImportStudent(name='cscheini2', school=u'sun', dn=u'uid=cscheini2,cn=schueler,cn=users,ou=sun,dc=schein,dc=me', old_dn=None) (source_uid:sun-student record_uid: 707005-3756): {'email': ['The email address is already taken by another user. Please change the email address.']} ValidationError({'email': ['The email address is already taken by another user. Please change the email address.']},)

So in this case the counter for the unique-email was not initialiszed.