From 2167b0d496544f2ce904cd0036fdb8dd809ff7a0 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 5 Mar 2021 23:39:43 +0100 Subject: fix longstanding bug in my crud controller --- animism-align/cli/app/controllers/user_controller.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'animism-align/cli/app/controllers/user_controller.py') diff --git a/animism-align/cli/app/controllers/user_controller.py b/animism-align/cli/app/controllers/user_controller.py index 26aa656..8fdc1f0 100644 --- a/animism-align/cli/app/controllers/user_controller.py +++ b/animism-align/cli/app/controllers/user_controller.py @@ -25,6 +25,7 @@ class UserView(CrudView): item.settings = form['settings'] def on_update(self, session, form, item): + current_user = get_jwt_identity() if not current_user['is_admin']: if item.id != current_user['id']: raise ValueError("Unauthorized") @@ -36,6 +37,7 @@ class UserView(CrudView): item.settings = form['settings'] def on_destroy(self, session, item): + current_user = get_jwt_identity() if not current_user['is_admin']: raise ValueError("Unauthorized") if item.id == current_user['id']: -- cgit v1.2.3-70-g09d2