Univention Bugzilla – Bug 51664
seed unique-usernames (unique-emails) database with existing usernames (emails)
Last modified: 2023-09-08 10:35:26 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.
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.