use sn/givenName/cn attributes

This commit is contained in:
Thomas NOËL 2016-05-19 16:09:24 +02:00 committed by Benjamin Dauvergne
parent 4d094a0e27
commit 96e6c0f463
1 changed files with 13 additions and 3 deletions

View File

@ -124,8 +124,18 @@ class CurieLdifParser(ldif.LDIFParser):
assert ic_entite in ('Recherche', 'Hopital', 'SI'), \
'valeur d\'ICEntite inconnue: %s' % ic_entite
supann_entite_affectation = ic_entite
prenom = self.assert_sv_attribute(entry, 'icprenomnaissance')
nom = self.assert_sv_attribute(entry, 'icnomnaissance')
if 'icprenomnaissance' in entry:
prenom = self.assert_sv_attribute(entry, 'icprenomnaissance')
else:
prenom = self.assert_sv_attribute(entry, 'givenname')
if 'icnomnaissance' in entry:
nom = self.assert_sv_attribute(entry, 'icnomnaissance')
else:
nom = self.assert_sv_attribute(entry, 'sn')
if 'cn' in entry:
cn = self.assert_sv_attribute(entry, 'cn')
else:
cn = strip_accents('%s %s' % (prenom, nom)).strip()
telephone = entry.get('telephoneNumber', [])
mail = entry.get('mail', [])
if ic_entite == 'Recherche':
@ -141,7 +151,7 @@ class CurieLdifParser(ldif.LDIFParser):
'uid': uid,
'sn': nom,
'givenName': prenom,
'cn': strip_accents('%s %s' % (prenom, nom)).strip(),
'cn': cn,
'mail': mail,
}
if supann_entite_affectation: