forked from ScoDoc/ScoDoc
CAS: synchro configuration
This commit is contained in:
parent
2f84d9968c
commit
363de7be76
@ -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"
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user