From 5b8b474d5c0335660a373c5e6aeee943a33298dd Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 26 Feb 2023 21:36:25 +0100 Subject: [PATCH] CAS: synchro configuration --- app/auth/cas.py | 3 ++- app/views/scodoc.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/auth/cas.py b/app/auth/cas.py index 067ea3506a..d9b2a08f20 100644 --- a/app/auth/cas.py +++ b/app/auth/cas.py @@ -56,11 +56,12 @@ def after_cas_logout(): return flask.redirect(url_for("scodoc.index")) -def set_cas_configuration(app: flask.app.Flask): +def set_cas_configuration(app: flask.app.Flask = None): """Force la configuration du module flask_cas à partir des paramètres de la config de ScoDoc. Appelé au démarrage et à chaque modif des paramètres. """ + app = app or current_app if ScoDocSiteConfig.is_cas_enabled(): app.config["CAS_SERVER"] = ScoDocSiteConfig.get("cas_server") app.config["CAS_AFTER_LOGIN"] = "auth.after_cas_login" diff --git a/app/views/scodoc.py b/app/views/scodoc.py index 6a9c5e0228..feedfd297d 100644 --- a/app/views/scodoc.py +++ b/app/views/scodoc.py @@ -54,6 +54,7 @@ from werkzeug.exceptions import BadRequest, NotFound from app import db from app.auth.models import User +from app.auth.cas import set_cas_configuration from app.decorators import ( admin_required, scodoc7func, @@ -149,7 +150,7 @@ def config_cas(): flash("Serveur CAS enregistré") if ScoDocSiteConfig.set("cas_attribute_id", form.data["cas_attribute_id"]): flash("Serveur CAS enregistré") - + set_cas_configuration() return redirect(url_for("scodoc.configuration")) elif request.method == "GET": form.cas_enable.data = ScoDocSiteConfig.get("cas_enable")