Script migration: traite départements nommés en minuscules
This commit is contained in:
parent
1c7bbc639a
commit
f4335624fc
@ -51,18 +51,17 @@ def import_scodoc7_user_db(scodoc7_db="dbname=SCOUSERS"):
|
||||
)
|
||||
# Set roles:
|
||||
# ScoDoc7 roles are stored as 'AdminRT,EnsRT'
|
||||
# ou, dans les rares cas où le dept est en minuscules
|
||||
# "Ensgeii,Admingeii"
|
||||
if u7["roles"]:
|
||||
roles7 = u7["roles"].split(",")
|
||||
else:
|
||||
roles7 = []
|
||||
for role_dept in roles7:
|
||||
# Cas particulier RespPeRT
|
||||
m = re.match(r"^(-?RespPe)([A-Z][A-Za-z0-9]*?)$", role_dept)
|
||||
# Migre les rôles RespPeX, EnsX, AdminX, SecrX et ignore les autres
|
||||
m = re.match(r"^(-?Ens|-?Secr|-?ResPe|-?Admin)(.*)$", role_dept)
|
||||
if not m:
|
||||
# Cas général: eg EnsRT
|
||||
m = re.match(r"^(-?[A-Za-z0-9]+?)([A-Z][A-Za-z0-9]*?)$", role_dept)
|
||||
if not m:
|
||||
msg = f"User {user_name}: invalid role '{role_dept}' (ignoring)"
|
||||
msg = f"User {user_name}: role inconnu '{role_dept}' (ignoré)"
|
||||
current_app.logger.warning(msg)
|
||||
messages.append(msg)
|
||||
else:
|
||||
|
@ -193,8 +193,8 @@ su -c "(cd $SCODOC_DIR && source venv/bin/activate && flask import-scodoc7-users
|
||||
# (ils ne sont d'ailleurs plus utilisés par ScoDoc 9)
|
||||
for f in "$SCODOC_VAR_DIR"/config/depts/*.cfg
|
||||
do
|
||||
dept=$(basename "${f%.*}")
|
||||
db_name=$(echo "SCO$dept" | tr "[:lower:]" "[:upper:]")
|
||||
dept=$(basename "${f%.*}") # le nom du dept peut-être en minuscules et/ou majuscules (geii, GEII...)
|
||||
db_name=$(echo "SCO$dept" | tr "[:lower:]" "[:upper:]") # nom de BD toujours en majuscule
|
||||
echo
|
||||
echo "----------------------------------------------"
|
||||
echo "| MIGRATION DU DEPARTEMENT $dept"
|
||||
|
Loading…
Reference in New Issue
Block a user