From d53b4e855e5a68b85f27fe7a36f975bc69a68afa Mon Sep 17 00:00:00 2001 From: Jacobe2169 Date: Wed, 14 Feb 2024 14:47:10 +0100 Subject: [PATCH 1/2] debug public login --- src/pypnusershub/routes.py | 11 +++++------ src/pypnusershub/utils.py | 12 ++++-------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/pypnusershub/routes.py b/src/pypnusershub/routes.py index 128c554..6f31ae1 100755 --- a/src/pypnusershub/routes.py +++ b/src/pypnusershub/routes.py @@ -142,15 +142,14 @@ def login(): def public_login(): if not current_app.config.get("PUBLIC_ACCESS_USERNAME", {}): raise Forbidden + login = current_app.config.get("PUBLIC_ACCESS_USERNAME") user = db.session.execute( - sa.select(models.AppUser) - .where( - models.AppUser.identifiant - == current_app.config.get("PUBLIC_ACCESS_USERNAME") - ) - .filter(models.AppUser.id_application == get_current_app_id()) + sa.select(models.User) + .where(models.User.identifiant == login) + .where(models.User.filter_by_app(code_app="GN")) ).scalar_one() + user_dict = user.as_dict() login_user(user) # Génération d'un token diff --git a/src/pypnusershub/utils.py b/src/pypnusershub/utils.py index d9a3318..f5dc0bc 100644 --- a/src/pypnusershub/utils.py +++ b/src/pypnusershub/utils.py @@ -81,15 +81,11 @@ def get_current_app_id(): elif "CODE_APPLICATION" in current_app.config: from pypnusershub.db.models import Application - return ( - db.session.execute( - select(Application).filter_by( - code_application=current_app.config["CODE_APPLICATION"], - ) + return db.session.execute( + select(Application.id_application).filter_by( + code_application=current_app.config["CODE_APPLICATION"], ) - .scalar_one() - .id_application - ) + ).scalar_one() else: return None From 91088a39a35ee228e3b0c40b73d6cb8eb44f7231 Mon Sep 17 00:00:00 2001 From: Jacobe2169 Date: Fri, 16 Feb 2024 10:22:05 +0100 Subject: [PATCH 2/2] update changelog and version --- VERSION | 2 +- docs/changelog.rst | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c212a7f..d1651b2 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -2.1.1 +2.1.2 diff --git a/docs/changelog.rst b/docs/changelog.rst index 49dd75a..c000122 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,13 @@ CHANGELOG ********* +2.1.2 (2024-02-16) +------------------ + +**🐛 Corrections** + +- Debug de la route utilisée pour l'accès public dans GeoNature (#89) + 2.1.1 (2024-01-30) -----------------