5
5
from functools import reduce
6
6
from operator import or_
7
7
8
- from flask import current_app as app
9
- from flask import request_started , url_for
8
+ from flask import current_app , request_started , url_for
10
9
from flask_login import AnonymousUserMixin , UserMixin , current_user
11
10
from passlib .apps import custom_app_context as pwd_context
12
11
from sqlalchemy .dialects import postgresql
@@ -129,7 +128,7 @@ def regenerate_api_key(self):
129
128
def to_dict (self , with_api_key = False ):
130
129
profile_image_url = self .profile_image_url
131
130
if self .is_disabled :
132
- assets = app .extensions ["webpack" ]["assets" ] or {}
131
+ assets = current_app .extensions ["webpack" ]["assets" ] or {}
133
132
path = "images/avatar.svg"
134
133
profile_image_url = url_for ("static" , filename = assets .get (path , path ))
135
134
@@ -158,7 +157,8 @@ def to_dict(self, with_api_key=False):
158
157
159
158
return d
160
159
161
- def is_api_user (self ):
160
+ @staticmethod
161
+ def is_api_user ():
162
162
return False
163
163
164
164
@property
@@ -377,7 +377,8 @@ class AnonymousUser(AnonymousUserMixin, PermissionsCheckMixin):
377
377
def permissions (self ):
378
378
return []
379
379
380
- def is_api_user (self ):
380
+ @staticmethod
381
+ def is_api_user ():
381
382
return False
382
383
383
384
@@ -397,7 +398,8 @@ def __init__(self, api_key, org, groups, name=None):
397
398
def __repr__ (self ):
398
399
return "<{}>" .format (self .name )
399
400
400
- def is_api_user (self ):
401
+ @staticmethod
402
+ def is_api_user ():
401
403
return True
402
404
403
405
@property
@@ -410,5 +412,9 @@ def org_id(self):
410
412
def permissions (self ):
411
413
return ["view_query" ]
412
414
413
- def has_access (self , obj , access_type ):
415
+ @staticmethod
416
+ def has_access (obj , access_type ):
414
417
return False
418
+
419
+ def get_actual_user (self ):
420
+ return repr (self )
0 commit comments