From 6b8159420a3deb87ba5ee477277b30ba994f4834 Mon Sep 17 00:00:00 2001 From: Chris McIntosh Date: Wed, 20 May 2020 16:30:26 -0700 Subject: [PATCH] Debug print statements to find TypeError bug. --- api/app/models/theq/csr.py | 1 + api/app/resources/theq/citizen/citizen_list.py | 1 + api/app/resources/theq/websocket.py | 1 + api/app/utilities/auth_util.py | 2 ++ 4 files changed, 5 insertions(+) diff --git a/api/app/models/theq/csr.py b/api/app/models/theq/csr.py index 0324f4ed4..6a8938db0 100644 --- a/api/app/models/theq/csr.py +++ b/api/app/models/theq/csr.py @@ -56,6 +56,7 @@ def find_by_username(cls, username): if cache.get(key): return cache.get(key) + print("==> In Python, csr.py, find_by_username: username=" + str(username) + "; idir_id=" + str(idir_id)) csr = CSR.query.filter(CSR.deleted.is_(None)).filter(CSR.username==idir_id).first() cache.set(key, csr) diff --git a/api/app/resources/theq/citizen/citizen_list.py b/api/app/resources/theq/citizen/citizen_list.py index c8297f35c..d751de775 100644 --- a/api/app/resources/theq/citizen/citizen_list.py +++ b/api/app/resources/theq/citizen/citizen_list.py @@ -38,6 +38,7 @@ def get(self): if not csr: raise Exception('no user found with username: `{}`'.format(g.oidc_token_info['username'])) active_state = CitizenState.query.filter_by(cs_state_name="Active").first() + print("==> In Python, citizen_list.py: active_state.cs_id: " + str(active_state.cs_id) + "; active_id: " + str(active_id)) citizens = Citizen.query.filter_by(office_id=csr.office_id, cs_id=active_state.cs_id) \ .order_by(Citizen.priority) \ .join(Citizen.service_reqs).all() diff --git a/api/app/resources/theq/websocket.py b/api/app/resources/theq/websocket.py index 2bbc6f0fe..021c6525e 100644 --- a/api/app/resources/theq/websocket.py +++ b/api/app/resources/theq/websocket.py @@ -34,6 +34,7 @@ def on_join(message): claims = jwt.get_unverified_claims(cookie) if claims["preferred_username"]: + print("==> In Python, @socketio.on('joinRoom'): claims['preferred_username'] is: " + str(claims["preferred_username"])) csr = CSR.find_by_username(claims["preferred_username"]) if csr: join_room(csr.office_id) diff --git a/api/app/utilities/auth_util.py b/api/app/utilities/auth_util.py index 69b06b994..a7338de27 100644 --- a/api/app/utilities/auth_util.py +++ b/api/app/utilities/auth_util.py @@ -43,6 +43,8 @@ def decorated(f): @wraps(f) def wrapper(*args, **kwargs): token_roles = g.oidc_token_info['realm_access']['roles'] + print("==> In Python, has_any_role, roles: " + str(roles)) + print(" --> token_roles: " + str(token_roles)) if any(role in token_roles for role in roles): return f(*args, **kwargs) abort(403)