Skip to content

Commit

Permalink
merge develop for 2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesfize committed Feb 16, 2024
2 parents 5e85d6c + 91088a3 commit b91fc6b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
2.1.1
2.1.2

7 changes: 7 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -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)
-----------------

Expand Down
11 changes: 5 additions & 6 deletions src/pypnusershub/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 4 additions & 8 deletions src/pypnusershub/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b91fc6b

Please sign in to comment.