redirige vers formulaire authentification

This commit is contained in:
Emmanuel Viennet 2021-07-28 09:42:22 +03:00
parent f435885315
commit 9646452457
3 changed files with 4 additions and 3 deletions

View File

@ -185,7 +185,6 @@ Principaux contenus:
# TODO # TODO
- redirection pour authentification
- import/export Excel - import/export Excel

View File

@ -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

View File

@ -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