From 0438cbb509c16cba38e1b3b8487fd3d39313ebc0 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 23 Jun 2023 11:59:45 +0200 Subject: [PATCH] fix --- ereuse_devicehub/modules/oidc/oauth2.py | 2 +- ereuse_devicehub/modules/oidc/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/modules/oidc/oauth2.py b/ereuse_devicehub/modules/oidc/oauth2.py index 68563efb..9c7c8a88 100644 --- a/ereuse_devicehub/modules/oidc/oauth2.py +++ b/ereuse_devicehub/modules/oidc/oauth2.py @@ -39,7 +39,7 @@ def exists_nonce(nonce, req): def generate_user_info(user, scope): if 'rols' in scope: - rols = user.get_rols_dlt() + rols = user.rols_dlt and user.get_rols_dlt() or [] return UserInfo(rols=rols, sub=str(user.id), name=user.email) return UserInfo(sub=str(user.id), name=user.email) diff --git a/ereuse_devicehub/modules/oidc/views.py b/ereuse_devicehub/modules/oidc/views.py index 5e4c30fe..815d83e4 100644 --- a/ereuse_devicehub/modules/oidc/views.py +++ b/ereuse_devicehub/modules/oidc/views.py @@ -211,7 +211,7 @@ class AllowCodeView(GenericMixin): msg = requests.get(url, headers=headers) self.userinfo = json.loads(msg.text) - rols = self.userinfo.get('rols', self.userinfo) + rols = self.userinfo.get('rols', []) session['rols'] = [(k, k) for k in rols] return self.userinfo