Recherche des utilisateurs dans le contexte d’un établissement
This commit is contained in:
@ -1,8 +1,18 @@
|
||||
diff --git usr/lib/python3/dist-packages/scribe/importation/writer.py usr/lib/python3/dist-packages/scribe/importation/writer.py
|
||||
index 34ce0fb..e4ddfea 100644
|
||||
index 34ce0fb..1f7ea1a 100644
|
||||
--- usr/lib/python3/dist-packages/scribe/importation/writer.py
|
||||
+++ usr/lib/python3/dist-packages/scribe/importation/writer.py
|
||||
@@ -900,10 +900,10 @@ def write_enseignant(store, connexion, etab=None, current_ead_user=config.DEFAUL
|
||||
@@ -841,9 +841,6 @@ def _maj_enseignant(enseignant, user, login, etab, administratif=False):
|
||||
groups = []
|
||||
# attention : des administratifs peuvent avoir un compte enseignant
|
||||
if isinstance(enseignant, Enseignant):
|
||||
- old_etab = user.get_etab(login)
|
||||
- if old_etab != etab:
|
||||
- user._change_etab(login, old_etab, etab)
|
||||
for joint in enseignant.get_classes():
|
||||
groups.append('profs-%s' % str(joint.classe.nom))
|
||||
if joint.profprincipal:
|
||||
@@ -900,10 +897,10 @@ def write_enseignant(store, connexion, etab=None, current_ead_user=config.DEFAUL
|
||||
else:
|
||||
login = ''
|
||||
else:
|
||||
@ -15,6 +25,16 @@ index 34ce0fb..e4ddfea 100644
|
||||
else:
|
||||
# nouvel enseignant
|
||||
if str(enseignant.nom) == '' or str(enseignant.prenom) == '':
|
||||
@@ -923,6 +920,9 @@ def write_enseignant(store, connexion, etab=None, current_ead_user=config.DEFAUL
|
||||
_sync_passwords(user, new_passwords, change_pwd=change_pwd)
|
||||
_create_dirs(user, quota, new_passwords)
|
||||
log.infolog("TOTAL : %d enseignants" % num)
|
||||
+ # write unmodified users list
|
||||
+ # filtrer les enseignants avec LastUpdate plus vieux que le début de l’import et vérifier qu’ils ne sont pas dans store.query(Enseignant) ?
|
||||
+ #user.ldap_admin._search(PROF_FILTER, attrlist=['uid'], suffix=branche_etab % {'etab': etab})
|
||||
if num != 0:
|
||||
log.copy_info(config.ENS_INFO, user=current_ead_user)
|
||||
|
||||
@@ -1027,7 +1027,7 @@ def write_administratif(store, connexion, etab=None, current_ead_user=config.DEF
|
||||
# personnel existe
|
||||
_maj_administratif(administratif, user, login)
|
||||
@ -25,9 +45,18 @@ index 34ce0fb..e4ddfea 100644
|
||||
# le personnel a été crée comme un professeur...
|
||||
log.infolog("(%s a un compte enseignant)" % login)
|
||||
diff --git usr/lib/python3/dist-packages/scribe/linker.py usr/lib/python3/dist-packages/scribe/linker.py
|
||||
index 71fb28d..09af637 100644
|
||||
index 71fb28d..44afa7a 100644
|
||||
--- usr/lib/python3/dist-packages/scribe/linker.py
|
||||
+++ usr/lib/python3/dist-packages/scribe/linker.py
|
||||
@@ -10,7 +10,7 @@
|
||||
et l'annuaire ldap
|
||||
"""
|
||||
from scribe.ldapconf import ELEVE_FILTER, PROF_FILTER, ADMINISTRATIF_FILTER, \
|
||||
-RESPONSABLE_FILTER, USER_FILTER, AUTRE_FILTER
|
||||
+RESPONSABLE_FILTER, USER_FILTER, AUTRE_FILTER, BRANCHE_ETAB
|
||||
from scribe.eoletools import deformate_date, strip_adresse
|
||||
from scribe.eoleldap import Ldap
|
||||
|
||||
@@ -99,7 +99,7 @@ def _responsable_exists(responsable, user):
|
||||
return res['uid'][0]
|
||||
return ''
|
||||
@ -37,3 +66,17 @@ index 71fb28d..09af637 100644
|
||||
"""
|
||||
recherche si un enseignant existe déjà dans l'annuaire
|
||||
enseignant : storage.Enseignant()
|
||||
@@ -129,8 +129,12 @@ def _enseignant_exists(enseignant, user):
|
||||
# beurk (homonymes) -> à améliorer
|
||||
#filtres.append("(&%s(cn=%s %s)(objectClass=enseignant))" % (USER_FILTER,
|
||||
# str(enseignant.prenom), str(enseignant.nom)))
|
||||
+ if etab:
|
||||
+ branche_etab = BRANCHE_ETAB % {'etab': etab}
|
||||
+ else:
|
||||
+ branche_etab = None
|
||||
for filtre in filtres:
|
||||
- res = user.ldap_admin._search_one(filtre, 'uid')
|
||||
+ res = user.ldap_admin._search_one(filtre, 'uid', suffix=branche_etab)
|
||||
if res != {}:
|
||||
return res['uid'][0]
|
||||
return ''
|
||||
|
Reference in New Issue
Block a user