From 3cf87f7f95113f4e4a154056e257de087a45658e Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 12 May 2023 12:05:41 +0200 Subject: [PATCH] add vars and get_user_id in model user --- ereuse_devicehub/config.py | 6 ++++++ ereuse_devicehub/resources/user/models.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/ereuse_devicehub/config.py b/ereuse_devicehub/config.py index 630a5ffb..16d2005a 100644 --- a/ereuse_devicehub/config.py +++ b/ereuse_devicehub/config.py @@ -97,3 +97,9 @@ class DevicehubConfig(Config): MAIL_DEFAULT_SENDER = config('MAIL_DEFAULT_SENDER', '') API_DLT = config('API_DLT', None) API_DLT_TOKEN = config('API_DLT_TOKEN', None) + + """Definition of oauth jwt details.""" + OAUTH2_JWT_ENABLED = config('OAUTH2_JWT_ENABLED', False) + OAUTH2_JWT_ISS = config('OAUTH2_JWT_ISS', '') + OAUTH2_JWT_KEY = config('OAUTH2_JWT_KEY', None) + OAUTH2_JWT_ALG = config('OAUTH2_JWT_ALG', 'HS256') diff --git a/ereuse_devicehub/resources/user/models.py b/ereuse_devicehub/resources/user/models.py index 2805e42a..75a598b1 100644 --- a/ereuse_devicehub/resources/user/models.py +++ b/ereuse_devicehub/resources/user/models.py @@ -41,6 +41,9 @@ class User(UserMixin, Thing): # todo set restriction that user has, at least, one active db + def get_user_id(self): + return self.id + def __init__( self, email, password=None, inventories=None, active=True, phantom=False ) -> None: