84 lines
3.6 KiB
Diff
84 lines
3.6 KiB
Diff
diff --git usr/share/ead2/backend/bin/importation.py usr/share/ead2/backend/bin/importation.py
|
|
index d18ad86d..306fe780 100755
|
|
--- usr/share/ead2/backend/bin/importation.py
|
|
+++ usr/share/ead2/backend/bin/importation.py
|
|
@@ -22,21 +22,22 @@ Ex :
|
|
|
|
2) importation.py --import -t maj enseignant
|
|
- Lance l'importation
|
|
"""
|
|
import getopt, sys
|
|
import json
|
|
import csv
|
|
from os.path import isfile
|
|
|
|
from scribe.eoleldap import Ldap
|
|
-from scribe.ldapconf import SUPPORT_ETAB
|
|
+from scribe.eoleuser import User
|
|
+from scribe.ldapconf import SUPPORT_ETAB, BRANCHE_ETAB, PROF_FILTER
|
|
from scribe.eoletools import nscd_start, nscd_stop
|
|
from scribe.storage import init_store
|
|
from scribe.parsing import sconet, aaf, be1d, scribecsv, scribecsv2
|
|
from scribe.importation import writer, config, log as importlog
|
|
from scribe.importation.config import CSV_PREFIX, WRITE_OPTS
|
|
if SUPPORT_ETAB:
|
|
from scribe.importation import preferences
|
|
|
|
sys.path.append('/usr/share')
|
|
from ead2.backend.actions.lib.importation.config import (PARSE_LOG_FILE,
|
|
@@ -456,20 +457,22 @@ class Importer(Logger):
|
|
importlog.debuglog("Arrêt de LSC...", title=True)
|
|
nscd_stop()
|
|
self.log_ok()
|
|
connexion = Ldap()
|
|
connexion.connect()
|
|
if SUPPORT_ETAB:
|
|
prefs = preferences.get_enseignants_prefs()
|
|
etab = prefs.get_default('etab')
|
|
etab_prefix = prefs.get_default('etab_prefix')
|
|
self.do_add_prefix_to_csv(etab,etab_prefix)
|
|
+ suffix=BRANCHE_ETAB % {'etab': etab}
|
|
+ old_logins = connexion._search('(&{})'.format(PROF_FILTER), 'uid', suffix=suffix)
|
|
else:
|
|
etab = None
|
|
etab_prefix = ''
|
|
if enseignants:
|
|
if self.import_type != 'maj':
|
|
self.log("Nettoyage des équipes pédagogiques<br />")
|
|
try:
|
|
writer.purge_equipes(connexion=connexion, etab=etab)
|
|
self.log_ok()
|
|
except Exception as error:
|
|
@@ -490,22 +493,30 @@ class Importer(Logger):
|
|
self.log_err(error=error)
|
|
try:
|
|
self.log("\nIntégration des options...<br />")
|
|
writer.verify_option(store=self.store, connexion=connexion,
|
|
etab_prefix=etab_prefix)
|
|
self.log_ok()
|
|
except Exception as error:
|
|
self.log_err(error=error)
|
|
try:
|
|
self.log("Intégration des enseignants...<br />")
|
|
- writer.write_enseignant(store=self.store, connexion=connexion,
|
|
+ logins = writer.write_enseignant(store=self.store, connexion=connexion,
|
|
etab=etab, current_ead_user=self.user)
|
|
+ if SUPPORT_ETAB and self.import_type == 'annu':
|
|
+ user = User()
|
|
+ user.has_ftp = True
|
|
+ user.ldap_admin = connexion
|
|
+ obsolete_logins = [login[1]['uid'][0] for login in old_logins if login[1]['uid'] not in logins]
|
|
+ for obsolete_login in obsolete_logins:
|
|
+ # eoleusers from dns and eoleuser._quit_etab
|
|
+ user._quit_etab(obsolete_login, etab=etab)
|
|
self.log_ok()
|
|
except Exception as error:
|
|
self.log_err(error=error)
|
|
try:
|
|
self.log("Intégration des services administratifs...<br />")
|
|
writer.write_service(store=self.store, connexion=connexion,
|
|
etab=etab, etab_prefix=etab_prefix)
|
|
self.log_ok()
|
|
except Exception as error:
|
|
self.log_err(error=error)
|