improve values for eduPersonAffiliation and eduPersonPrimaryAffiliation

Value is set based on employment and being part of the IT departement.
This commit is contained in:
Benjamin Dauvergne 2016-12-23 18:54:23 +01:00
parent ea5357e001
commit 7c704cf539
1 changed files with 28 additions and 4 deletions

View File

@ -54,11 +54,11 @@ class CurieLdifParser(ldif.LDIFParser):
telephoneNumber <- telephoneNumber
si LDAP.ICEntite == 'Recherche':
suppanEntiteAffectationPrincipale = LDAP.ICEquipeRecherche[0]['OU']
supannEntiteAffectationPrincipale = LDAP.ICEquipeRecherche[0]['OU']
supannEntiteAffectation = LDAP.ICEntite
sinon si LDAP.ICEntite == 'Hopital'
supannEntiteAffectation = LDAP.ICEntite
sinon si LDAP.ICEneite == 'SI'
sinon si LDAP.ICEntite == 'SI'
supannEntiteAffectation = LDAP.ICEntite
sinon:
error
@ -112,8 +112,6 @@ class CurieLdifParser(ldif.LDIFParser):
'userPassword': user_password,
'supannListeRouge': supann_liste_rouge,
'eduPersonPrincipalName': supann_alias_login + '@curie.fr',
'eduPersonAffiliation': 'member',
'eduPersonPrimaryAffiliation': 'member',
})
self.users[uid].setdefault('_source', set()).add('ad')
@ -126,6 +124,12 @@ class CurieLdifParser(ldif.LDIFParser):
def handle_sun(self, dn, entry):
uid = self.assert_sv_attribute(entry, 'uid')
if entry.get('iclibelleentite', []) == ['SI']:
cat_personnel = 'member'
else:
cat_personnel = ''
if 'icprenomnaissance' in entry:
prenom = self.assert_sv_attribute(entry, 'icprenomnaissance')
else:
@ -141,6 +145,24 @@ class CurieLdifParser(ldif.LDIFParser):
mail = entry.get('mail', [])
supann_entite_affectation = []
supann_entite_affectation_principale = []
edu_person_affiliation = []
edu_person_primary_affiliation = []
try:
emploi_tmp = self.assert_sv_attribute(entry, 'icemploi')
except AssertionError, e:
self.errors.append(Error(dn, str(e)))
else:
ou = self.extract_top_rdn(emploi_tmp)
if (ou == 'RAR') or (ou == 'RCH'):
cat_personnel = 'faculty'
elif (ou == 'RDO') or (ou == 'RSR'):
cat_personnel = 'student'
else:
cat_personnel = 'member'
edu_person_primary_affiliation.append(cat_personnel)
edu_person_affiliation.append(cat_personnel)
try:
ic_equipe_recherche = self.assert_sv_attribute(entry, 'icequiperecherche')
@ -173,6 +195,8 @@ class CurieLdifParser(ldif.LDIFParser):
'supannEntiteAffectationPrincipale': supann_entite_affectation_principale,
'supanncivilite': supann_civilite,
'supannEtablissement': '{UAI}0753172R',
'eduPersonAffiliation': edu_person_affiliation,
'eduPersonPrimaryAffiliation': edu_person_primary_affiliation,
}
if entry.get('iclisterouge') and entry['iclisterouge'][0]:
d['icListeRouge'] = [entry['iclisterouge'][0].upper()]