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) ----------------- 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