c2cgeoportal-geoportal 2.9.0.174__py3-none-any.whl → 2.9.0.180__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- c2cgeoportal_geoportal/__init__.py +0 -2
- c2cgeoportal_geoportal/lib/oidc.py +34 -16
- c2cgeoportal_geoportal/views/login.py +2 -4
- c2cgeoportal_geoportal/views/theme.py +1 -2
- {c2cgeoportal_geoportal-2.9.0.174.dist-info → c2cgeoportal_geoportal-2.9.0.180.dist-info}/METADATA +1 -1
- {c2cgeoportal_geoportal-2.9.0.174.dist-info → c2cgeoportal_geoportal-2.9.0.180.dist-info}/RECORD +10 -10
- tests/__init__.py +1 -1
- {c2cgeoportal_geoportal-2.9.0.174.dist-info → c2cgeoportal_geoportal-2.9.0.180.dist-info}/WHEEL +0 -0
- {c2cgeoportal_geoportal-2.9.0.174.dist-info → c2cgeoportal_geoportal-2.9.0.180.dist-info}/entry_points.txt +0 -0
- {c2cgeoportal_geoportal-2.9.0.174.dist-info → c2cgeoportal_geoportal-2.9.0.180.dist-info}/top_level.txt +0 -0
@@ -42,10 +42,8 @@ import c2cwsgiutils.db
|
|
42
42
|
import c2cwsgiutils.index
|
43
43
|
import dateutil.parser
|
44
44
|
import pyramid.config
|
45
|
-
import pyramid.renderers
|
46
45
|
import pyramid.request
|
47
46
|
import pyramid.response
|
48
|
-
import pyramid.security
|
49
47
|
import sqlalchemy
|
50
48
|
import sqlalchemy.orm
|
51
49
|
import zope.event.classhandler
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2024, Camptocamp SA
|
1
|
+
# Copyright (c) 2024-2025, Camptocamp SA
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -28,6 +28,7 @@
|
|
28
28
|
import datetime
|
29
29
|
import json
|
30
30
|
import logging
|
31
|
+
import string
|
31
32
|
from typing import TYPE_CHECKING, Any, NamedTuple, Optional, TypedDict, Union
|
32
33
|
|
33
34
|
import pyramid.request
|
@@ -77,7 +78,7 @@ def get_oidc_client(request: pyramid.request.Request, host: str) -> simple_openi
|
|
77
78
|
url=openid_connect["url"],
|
78
79
|
authentication_redirect_uri=request.route_url("oidc_callback"),
|
79
80
|
client_id=openid_connect["client_id"],
|
80
|
-
client_secret=openid_connect.get("
|
81
|
+
client_secret=openid_connect.get("client_secret"),
|
81
82
|
scope=" ".join(openid_connect.get("scopes", ["openid", "profile", "email"])),
|
82
83
|
)
|
83
84
|
|
@@ -124,16 +125,31 @@ def get_remember_from_user_info(
|
|
124
125
|
("settings_role", None),
|
125
126
|
("roles", None),
|
126
127
|
):
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
128
|
+
_LOG.debug("User info keys: %s", ", ".join(user_info.keys()))
|
129
|
+
user_info_field_template = settings_fields.get(field_, default_field)
|
130
|
+
if user_info_field_template is not None:
|
131
|
+
if "{" in user_info_field_template:
|
132
|
+
formatter = string.Formatter()
|
133
|
+
attributes = formatter.parse(user_info_field_template)
|
134
|
+
user_info_fields = [e[1] for e in attributes if e[1] is not None]
|
135
|
+
else:
|
136
|
+
user_info_fields = [user_info_field_template]
|
137
|
+
|
138
|
+
for user_info_field in user_info_fields:
|
139
|
+
if user_info_field not in user_info:
|
140
|
+
_LOG.error(
|
141
|
+
"Field '%s' not found in user info, available: %s.",
|
142
|
+
user_info_field,
|
143
|
+
", ".join(user_info.keys()),
|
144
|
+
)
|
145
|
+
raise HTTPInternalServerError(f"Field '{user_info_field}' not found in user info.")
|
146
|
+
|
147
|
+
user_info_value = (
|
148
|
+
user_info_field_template.format(**user_info)
|
149
|
+
if "{" in user_info_field_template
|
150
|
+
else user_info[user_info_field_template]
|
151
|
+
)
|
152
|
+
remember_object[field_] = user_info_value # type: ignore[literal-required]
|
137
153
|
|
138
154
|
|
139
155
|
def get_user_from_remember(
|
@@ -194,6 +210,11 @@ def get_user_from_remember(
|
|
194
210
|
user = static.User(username=username, email=email, display_name=display_name)
|
195
211
|
models.DBSession.add(user)
|
196
212
|
else:
|
213
|
+
roles = []
|
214
|
+
role_names = remember_object.get("roles", [])
|
215
|
+
if role_names:
|
216
|
+
query = models.DBSession.query(main.Role).filter(main.Role.name.in_(role_names))
|
217
|
+
roles = query.all()
|
197
218
|
user = DynamicUser(
|
198
219
|
id=-1,
|
199
220
|
username=username,
|
@@ -204,10 +225,7 @@ def get_user_from_remember(
|
|
204
225
|
if remember_object.get("settings_role") is not None
|
205
226
|
else None
|
206
227
|
),
|
207
|
-
roles=
|
208
|
-
models.DBSession.query(main.Role).filter_by(name=role).one()
|
209
|
-
for role in remember_object.get("roles", [])
|
210
|
-
],
|
228
|
+
roles=roles,
|
211
229
|
)
|
212
230
|
return user
|
213
231
|
|
@@ -331,8 +331,7 @@ class Login:
|
|
331
331
|
if user is not None:
|
332
332
|
result.update(
|
333
333
|
{
|
334
|
-
"
|
335
|
-
"username": user.display_name,
|
334
|
+
"username": user.username,
|
336
335
|
"display_name": user.display_name,
|
337
336
|
"email": user.email,
|
338
337
|
"roles": [{"name": r.name, "id": r.id} for r in user.roles],
|
@@ -673,8 +672,7 @@ class Login:
|
|
673
672
|
# TODO respect the user interface...
|
674
673
|
json.dumps(
|
675
674
|
{
|
676
|
-
"
|
677
|
-
"username": user.display_name,
|
675
|
+
"username": user.username,
|
678
676
|
"email": user.email,
|
679
677
|
"is_intranet": is_intranet(self.request),
|
680
678
|
"functionalities": self._functionality(),
|
@@ -1279,8 +1279,7 @@ class Theme:
|
|
1279
1279
|
if not self.request.user:
|
1280
1280
|
raise pyramid.httpexceptions.HTTPForbidden()
|
1281
1281
|
|
1282
|
-
|
1283
|
-
if not admin_roles:
|
1282
|
+
if not self.request.has_permission("admin"):
|
1284
1283
|
raise pyramid.httpexceptions.HTTPForbidden()
|
1285
1284
|
|
1286
1285
|
self._ogc_server_clear_cache(
|
{c2cgeoportal_geoportal-2.9.0.174.dist-info → c2cgeoportal_geoportal-2.9.0.180.dist-info}/RECORD
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
c2cgeoportal_geoportal/__init__.py,sha256=
|
1
|
+
c2cgeoportal_geoportal/__init__.py,sha256=yy2McB6HK2pGoLYAZ8sjkwXl_uxdKOVVmynOovyO0ks,38648
|
2
2
|
c2cgeoportal_geoportal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
c2cgeoportal_geoportal/resources.py,sha256=n42Gns8DKw32GstDoUdNgud6xdAidaRwgAuNHqGH-c4,2158
|
4
4
|
c2cgeoportal_geoportal/lib/__init__.py,sha256=_67fO_aXQZRnxPXcShHBcs38mdYU5ch0FNX89RwMTgA,10431
|
@@ -20,7 +20,7 @@ c2cgeoportal_geoportal/lib/lingva_extractor.py,sha256=pS-B5oTcEkW__XUop6rWKdpJhn
|
|
20
20
|
c2cgeoportal_geoportal/lib/loader.py,sha256=vfjyuN2ry33Djc5KMTbibQ96uAw8oZyomAAwk0gbW5Q,2613
|
21
21
|
c2cgeoportal_geoportal/lib/metrics.py,sha256=5HryUs6Rk6cmVvag5_FN-W2gcwsyJt3Xf9105TSO4mQ,4847
|
22
22
|
c2cgeoportal_geoportal/lib/oauth2.py,sha256=1hXo78-8lg3OBvB0TK5zG5QawZnvroPhaVpTBtPZg8I,41107
|
23
|
-
c2cgeoportal_geoportal/lib/oidc.py,sha256=
|
23
|
+
c2cgeoportal_geoportal/lib/oidc.py,sha256=r4O-htcKiyxUlzcNMkPJ3smaM7TkfHVT6bH1qYwm2Ss,13017
|
24
24
|
c2cgeoportal_geoportal/lib/wmstparsing.py,sha256=EWFXxZ_nK3vpx8H3dSKIJTnNAXoJmfhhHYkcG1bXluI,12379
|
25
25
|
c2cgeoportal_geoportal/lib/xsd.py,sha256=V5dXPWTVIz04LoI5GDkorFnaLrLUhlw--c6NzWsAxfk,7031
|
26
26
|
c2cgeoportal_geoportal/scaffolds/advance_create/cookiecutter.json,sha256=1LVOM-j_nd00J89q0EI3bQUvIysbidApaVHDibA2ydk,524
|
@@ -160,7 +160,7 @@ c2cgeoportal_geoportal/views/fulltextsearch.py,sha256=uiidVzz-mQ-_eF1GL3ZCWd67-p
|
|
160
160
|
c2cgeoportal_geoportal/views/geometry_processing.py,sha256=5dkJ20Lk12zqfzvmfws2YFxutSX2vxzdetQ4CmYxSi8,2958
|
161
161
|
c2cgeoportal_geoportal/views/i18n.py,sha256=EEyM5Y7DSuQffiwpFrkFclUcneRCiir4bakXY6lGZjI,5343
|
162
162
|
c2cgeoportal_geoportal/views/layers.py,sha256=I1_9N8Zui4b2t9qfX1Z4QGX7-vOPeUKKvyJWLH8g9Fo,29226
|
163
|
-
c2cgeoportal_geoportal/views/login.py,sha256=
|
163
|
+
c2cgeoportal_geoportal/views/login.py,sha256=YdtAcOkdBOWcNpJEKBgtvnbhoNA_5DuMYjr9lF8ndZw,29189
|
164
164
|
c2cgeoportal_geoportal/views/mapserverproxy.py,sha256=ii_389rDXNMbtk4cWD9BSp3dDBZVin0_KsbsxPvCtkk,9498
|
165
165
|
c2cgeoportal_geoportal/views/memory.py,sha256=Vhw3vf4pjdl9DuW2PNOK6PZZOUPUn09Otym88_XIy3s,3754
|
166
166
|
c2cgeoportal_geoportal/views/ogcproxy.py,sha256=2i3cuZ2cRybEH-DvAQbrLnUxd9y3B0iKnwkpaJvhwSc,5215
|
@@ -171,10 +171,10 @@ c2cgeoportal_geoportal/views/proxy.py,sha256=XxOGR8Snqrd1CKkUiK4IjavCR8PiUsd3tlE
|
|
171
171
|
c2cgeoportal_geoportal/views/raster.py,sha256=kY6rYo4SxQP9JLbsq3_kdWdbaTVkdQDdpjrG9lUtAIM,9242
|
172
172
|
c2cgeoportal_geoportal/views/resourceproxy.py,sha256=pcHwU6hAXHeh_Ef6tuHxpRzGje8nqVKUxyZwZKOPCjI,3189
|
173
173
|
c2cgeoportal_geoportal/views/shortener.py,sha256=t-05vHSbsp6aIYV6fKk-ic6Zo45TLePIlGnPAzwrzQU,6179
|
174
|
-
c2cgeoportal_geoportal/views/theme.py,sha256=
|
174
|
+
c2cgeoportal_geoportal/views/theme.py,sha256=npI1Z-Z3304ZrLDnCOwxbQGTA0D9AsTr70VIEpJ1lVY,55862
|
175
175
|
c2cgeoportal_geoportal/views/tinyowsproxy.py,sha256=_wPN1Vfo4RNcCQ1xRPU_funie7mDPocL-ox_4hlF1-Y,8178
|
176
176
|
c2cgeoportal_geoportal/views/vector_tiles.py,sha256=2bF3j6WvOpXAJULsEfy7pfeUBeKVheMlcUOWzHVow90,3575
|
177
|
-
tests/__init__.py,sha256=
|
177
|
+
tests/__init__.py,sha256=QJY_VGdOehpa3uMdeiF0boDPvH8BVgxPWJRzyDTcvwA,3826
|
178
178
|
tests/test_cachebuster.py,sha256=asI1X_qI0MGklYuKuWyqvCPVbvhQcUe4fX91Dk-hUsE,2923
|
179
179
|
tests/test_caching.py,sha256=Juj7uwjOkjbPlTd-ll65SgWFzj3d2yDyf-eQ7ELk2eY,13222
|
180
180
|
tests/test_checker.py,sha256=NaU6Ejg9XbwS2cwqXCtz5mJPRdBIPZb3d1MkXVufr0k,3638
|
@@ -187,8 +187,8 @@ tests/test_mapserverproxy_route_predicate.py,sha256=SzILSSzIuilzIkUYVPZiVzLwW1du
|
|
187
187
|
tests/test_raster.py,sha256=82NJ2MXgZlMqs0ytN-VgNw376iURdk4PkAg__dyh5ns,11948
|
188
188
|
tests/test_wmstparsing.py,sha256=xjA8nJuXFl3H5Bfs4sJw_8qX8E8qvAALK7Hs2-DTP2A,9054
|
189
189
|
tests/xmlstr.py,sha256=rkTKSU4FGjupBKLx75H8o-goB0KbQrxDvdpc6xVX_uQ,5985
|
190
|
-
c2cgeoportal_geoportal-2.9.0.
|
191
|
-
c2cgeoportal_geoportal-2.9.0.
|
192
|
-
c2cgeoportal_geoportal-2.9.0.
|
193
|
-
c2cgeoportal_geoportal-2.9.0.
|
194
|
-
c2cgeoportal_geoportal-2.9.0.
|
190
|
+
c2cgeoportal_geoportal-2.9.0.180.dist-info/METADATA,sha256=8rsohSha4kU5yh2iX3ENMGIBe9pvS39xWgcXAn2qZb4,1923
|
191
|
+
c2cgeoportal_geoportal-2.9.0.180.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
192
|
+
c2cgeoportal_geoportal-2.9.0.180.dist-info/entry_points.txt,sha256=3dnX260FsLX_AubeNMdyeta_z1X4CxcD3steAlfPx2I,1414
|
193
|
+
c2cgeoportal_geoportal-2.9.0.180.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
|
194
|
+
c2cgeoportal_geoportal-2.9.0.180.dist-info/RECORD,,
|
tests/__init__.py
CHANGED
{c2cgeoportal_geoportal-2.9.0.174.dist-info → c2cgeoportal_geoportal-2.9.0.180.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|