Removed circular import for DB
This commit is contained in:
parent
755cb03aaf
commit
d09d9d77bd
5 changed files with 88 additions and 4 deletions
|
|
@ -41,9 +41,15 @@ from helpers import (
|
|||
kratos_error,
|
||||
global_error,
|
||||
hydra_error,
|
||||
KratosUser
|
||||
KratosUser,
|
||||
App,
|
||||
AppRole
|
||||
)
|
||||
|
||||
# This is a circular import and should be solved differently
|
||||
#from app import db
|
||||
from database import db
|
||||
|
||||
# APIs
|
||||
# Create HYDRA & KRATOS API interfaces
|
||||
HYDRA = hydra_client.HydraAdmin(HYDRA_ADMIN_URL)
|
||||
|
|
@ -240,8 +246,7 @@ def consent():
|
|||
abort(401, description="User not found. Please try again.")
|
||||
|
||||
# Get role on this app
|
||||
#app_obj = db.session.query(App).filter(App.slug == app_id).first()
|
||||
app_obj = False
|
||||
app_obj = db.session.query(App).filter(App.slug == app_id).first()
|
||||
|
||||
# Default access level
|
||||
roles = []
|
||||
|
|
@ -253,6 +258,7 @@ def consent():
|
|||
)
|
||||
for role_obj in role_objects:
|
||||
roles.append(role_obj.role)
|
||||
|
||||
current_app.logger.info(f"Using '{roles}' when applying consent for {kratos_id}")
|
||||
|
||||
# Get claims for this user, provided the current app
|
||||
|
|
|
|||
Reference in a new issue