add as global g.user current_user
This commit is contained in:
parent
b730537cde
commit
9413e7b3c7
|
@ -8,6 +8,8 @@ import click_spinner
|
||||||
import ereuse_utils.cli
|
import ereuse_utils.cli
|
||||||
from ereuse_utils.session import DevicehubClient
|
from ereuse_utils.session import DevicehubClient
|
||||||
from flask.globals import _app_ctx_stack, g
|
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 flask_sqlalchemy import SQLAlchemy
|
||||||
from teal.db import SchemaSQLAlchemy
|
from teal.db import SchemaSQLAlchemy
|
||||||
from teal.teal import Teal
|
from teal.teal import Teal
|
||||||
|
@ -78,6 +80,7 @@ class Devicehub(Teal):
|
||||||
|
|
||||||
@login_manager.user_loader
|
@login_manager.user_loader
|
||||||
def load_user(user_id):
|
def load_user(user_id):
|
||||||
|
gg.user = current_user
|
||||||
return User.query.get(user_id)
|
return User.query.get(user_id)
|
||||||
|
|
||||||
# noinspection PyMethodOverriding
|
# noinspection PyMethodOverriding
|
||||||
|
|
Reference in New Issue