sépare la création automatique de la simple création du compte
This commit is contained in:
parent
3026f2bed8
commit
c6b241935c
|
@ -109,14 +109,19 @@ class ProfilRechercheAuthentification(ProfilMoteurAuthentification):
|
|||
return self.recherche_ldap(filter_format('(%s=%s)',
|
||||
(settings.LDAP_CAS_UID, identifiant)))
|
||||
|
||||
def creation_du_compte(self, identifiant, cas_url, ldap_resultat):
|
||||
'''Création de compte depuis le LDAP
|
||||
'''
|
||||
return self.profil_classe.new_cas_user(identifiant,
|
||||
(ldap_resultat[0][1][self.MAIL] or [''])[0], cas_url)
|
||||
|
||||
def creation_automatique_du_compte(self, identifiant, cas_url, ldap_resultat):
|
||||
'''Si le compte LDAP pour l'identifiant CAS identifiant est un compte d'étudiant,
|
||||
on lui crée automatiquement un profil recherche.
|
||||
'''
|
||||
if len(ldap_resultat) and 'student' in \
|
||||
ldap_resultat[0][1][self.EDU_PERSON_AFFILIATION]:
|
||||
return self.profil_classe.new_cas_user(identifiant,
|
||||
(ldap_resultat[0][1][self.MAIL] or [''])[0], cas_url)
|
||||
return self.creation_du_compte(identifiant, cas_url, ldap_resultat)
|
||||
return None
|
||||
|
||||
@catch_ldap_error
|
||||
|
|
|
@ -380,7 +380,7 @@ class InjectionProfilRechercheForm(Form):
|
|||
user = models.ProfilRecherche.objects.get(
|
||||
utilisateur_cas__identifiant=compte)
|
||||
except models.ProfilRecherche.DoesNotExist:
|
||||
user = backend.creation_automatique_du_compte(compte, 'dauphine', ldap_resultat)
|
||||
user = backend.creation_du_compte(compte, 'dauphine', ldap_resultat)
|
||||
i += 1
|
||||
user.type_d_offre = self.cleaned_data['type_d_offre']
|
||||
user.save()
|
||||
|
|
Reference in New Issue