From 9413e7b3c7202ffdb0780625ca801fdc06b1d38b Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 3 Jan 2022 11:31:40 +0100 Subject: [PATCH] add as global g.user current_user --- ereuse_devicehub/devicehub.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ereuse_devicehub/devicehub.py b/ereuse_devicehub/devicehub.py index b4321e28..f97e7b74 100644 --- a/ereuse_devicehub/devicehub.py +++ b/ereuse_devicehub/devicehub.py @@ -8,6 +8,8 @@ import click_spinner import ereuse_utils.cli from ereuse_utils.session import DevicehubClient from flask.globals import _app_ctx_stack, g +from flask_login import current_user +from flask import g as gg from flask_sqlalchemy import SQLAlchemy from teal.db import SchemaSQLAlchemy from teal.teal import Teal @@ -78,6 +80,7 @@ class Devicehub(Teal): @login_manager.user_loader def load_user(user_id): + gg.user = current_user return User.query.get(user_id) # noinspection PyMethodOverriding