forked from ScoDoc/ScoDoc
redirige vers formulaire authentification
This commit is contained in:
parent
f435885315
commit
9646452457
@ -185,7 +185,6 @@ Principaux contenus:
|
|||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
- redirection pour authentification
|
|
||||||
- import/export Excel
|
- import/export Excel
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ auth.routes.py
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from flask import render_template, redirect, url_for, current_app, flash, request
|
from flask import render_template, redirect, url_for, current_app, flash, request
|
||||||
|
from flask_login.utils import login_required
|
||||||
from werkzeug.urls import url_parse
|
from werkzeug.urls import url_parse
|
||||||
from flask_login import login_user, logout_user, current_user
|
from flask_login import login_user, logout_user, current_user
|
||||||
|
|
||||||
|
@ -108,11 +108,12 @@ def permission_required(permission):
|
|||||||
# current_app.logger.info(
|
# current_app.logger.info(
|
||||||
# "permission_required: %s in %s" % (permission, g.scodoc_dept)
|
# "permission_required: %s in %s" % (permission, g.scodoc_dept)
|
||||||
# )
|
# )
|
||||||
if not current_user.has_permission(permission, g.scodoc_dept):
|
scodoc_dept = getattr(g, "scodoc_dept", None)
|
||||||
|
if not current_user.has_permission(permission, scodoc_dept):
|
||||||
abort(403)
|
abort(403)
|
||||||
return f(*args, **kwargs)
|
return f(*args, **kwargs)
|
||||||
|
|
||||||
return decorated_function
|
return login_required(decorated_function)
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user