Skip to content

Commit

Permalink
403 fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
maksii committed Jun 18, 2024
1 parent 91185bc commit b00a3ef
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/routes/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,11 @@ def on_identity_loaded(sender, identity):

# Assuming the User model has a list of roles, update the identity with the roles that the user provides
if hasattr(current_user, 'roles'):
identity.provides.add(RoleNeed(current_user.roles))
identity.provides.add(RoleNeed(current_user.roles))

#As user can use remember me, just a hacki fix to be sure, that hi identity updated before each request
#require some testing overtime to see if it will change behavior
@app.before_request
def before_request():
if current_user.is_authenticated:
identity_changed.send(current_app._get_current_object(), identity=Identity(current_user.id))

0 comments on commit b00a3ef

Please sign in to comment.