From 4bb79e685318143eea697d100706330694943364 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 11 Sep 2021 19:05:19 +0200 Subject: [PATCH] =?UTF-8?q?Petits=20correctifs=20suite=20=C3=A0=20migratio?= =?UTF-8?q?n=20iutv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_find_etud.py | 2 +- app/views/scodoc.py | 27 +++++++++++++++++++++++++++ tools/import_scodoc7_dept.py | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/app/scodoc/sco_find_etud.py b/app/scodoc/sco_find_etud.py index 13426bea..77109da1 100644 --- a/app/scodoc/sco_find_etud.py +++ b/app/scodoc/sco_find_etud.py @@ -225,7 +225,7 @@ def search_etuds_infos(expnom=None, code_nip=None): else: code_nip = code_nip or expnom if code_nip: - etuds = sco_etud.etudident_list(cnx, args={"code_nip": code_nip}) + etuds = sco_etud.etudident_list(cnx, args={"code_nip": str(code_nip)}) else: etuds = [] sco_etud.fill_etuds_info(etuds) diff --git a/app/views/scodoc.py b/app/views/scodoc.py index 1a7e8537..5bfce95b 100644 --- a/app/views/scodoc.py +++ b/app/views/scodoc.py @@ -37,6 +37,7 @@ import flask from flask import abort, flash, url_for, redirect, render_template, send_file from flask import request from flask.app import Flask +import flask_login from flask_login.utils import login_required from flask_wtf import FlaskForm from flask_wtf.file import FileField, FileAllowed @@ -57,6 +58,7 @@ from app.scodoc import sco_utils as scu from app.decorators import ( admin_required, scodoc7func, + scodoc, permission_required_compat_scodoc7, ) from app.scodoc.sco_permissions import Permission @@ -131,6 +133,31 @@ def get_etud_dept(): return Departement.query.get(last_etud.dept_id).acronym +# Bricolage pour le portail IUTV avec ScoDoc 7: (DEPRECATED: NE PAS UTILISER !) +@bp.route( + "/ScoDoc/search_inscr_etud_by_nip", methods=["GET"] +) # pour compat anciens clients PHP +@scodoc +@scodoc7func +def search_inscr_etud_by_nip( + code_nip, REQUEST=None, format="json", __ac_name="", __ac_password="" +): + auth_ok = False + user_name = __ac_name + user_password = __ac_password + if user_name and user_password: + u = User.query.filter_by(user_name=user_name).first() + if u and u.check_password(user_password): + auth_ok = True + flask_login.login_user(u) + if not auth_ok: + abort(403) + else: + return sco_find_etud.search_inscr_etud_by_nip( + code_nip=code_nip, REQUEST=REQUEST, format=format + ) + + @bp.route("/ScoDoc/about") @bp.route("/ScoDoc/Scolarite//about") def about(scodoc_dept=None): diff --git a/tools/import_scodoc7_dept.py b/tools/import_scodoc7_dept.py index 2178e285..a9a727f5 100644 --- a/tools/import_scodoc7_dept.py +++ b/tools/import_scodoc7_dept.py @@ -381,6 +381,8 @@ def convert_object( "absences_notifications", "itemsuivi", # etudid n'était pas une clé "adresse", # etudid n'était pas une clé + "admissions", # idem + "scolar_events", }: # tables avec "fausses" clés # (l'object référencé a pu disparaitre)