Univention Bugzilla – Bug 37821
CSV import should not create overlong or invalid usernames
Last modified: 2015-02-27 15:19:36 CET
Currently the CSV import assembles autocreated usernames by attaching first name, dot and last name. If invalid characters are present in first or last name the following syntax will complain about the invalid username. This is also the case if the resulting username is longer than 15 characters (20 character limitation for samAccountName minus "exam-"). The syntax check will complain, too.
The generated usernames should - contain only valid characters - be not too long - be unique - reproducible (same user generates same username during another import) (if possible, otherwise it produces new errors).
Invalid character are stripped now. Username consists of firstname and lastname stripped at 5 characters, stipped at 20 - len(exam-prefix). Old behavior can be achieved by UCR variable ucsschool/csvimport/username/generation/firstname_lastname. TODO: doku, release notes, etc.
Please set ucsschool/csvimport/username/generation/firstname_lastname=true in postinst script during update (not during fresh installations!). I would suggest the following addon patch: --- a/ucs-school-4.0/ucs-school-umc-csv-import/umc/python/schoolcsvimport/util.py +++ b/ucs-school-4.0/ucs-school-umc-csv-import/umc/python/schoolcsvimport/util.py @@ -104,12 +104,12 @@ class CSVUser(User): if self.lastname: lastname = u'%s' % (self.lastname.split()[-1].lower()) - if ucr.is_true('ucsschool/csvimport/username/generation/firstname_lastname', False): - return firstname + (u'.' if firstname else u'') + lastname - firstname = self.RE_UID_INVALID.sub('', firstname) lastname = self.RE_UID_INVALID.sub('', lastname) + if ucr.is_true('ucsschool/csvimport/username/generation/firstname_lastname', False): + return firstname + (u'.' if firstname else u'') + lastname + if firstname: firstname = firstname[:5] + '.' Otherwise invalid characters will not be removed if old username format is used.
* Changelog added * postinst adapted * adapted patch from comment #3 applied Packages are currently building.
OK - debian/changelog OK - changelog OK - username -- contain only valid charactersbe -- not too long -- be unique -- reproducible
UCS@school 4.0 v2 has been released: http://docs.univention.de/release-notes-ucsschool-4.0v2-de.html If this error occurs again, please use "Clone This Bug".