c2cgeoportal-geoportal 2.9rc10__py3-none-any.whl → 2.9rc11__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 +16 -1
- c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/docker-compose-lib.yaml +2 -0
- c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/tests/test_app.py +37 -2
- c2cgeoportal_geoportal/scripts/create_demo_theme.py +11 -6
- c2cgeoportal_geoportal/views/mapserverproxy.py +65 -18
- {c2cgeoportal_geoportal-2.9rc10.dist-info → c2cgeoportal_geoportal-2.9rc11.dist-info}/METADATA +1 -1
- {c2cgeoportal_geoportal-2.9rc10.dist-info → c2cgeoportal_geoportal-2.9rc11.dist-info}/RECORD +10 -10
- {c2cgeoportal_geoportal-2.9rc10.dist-info → c2cgeoportal_geoportal-2.9rc11.dist-info}/WHEEL +0 -0
- {c2cgeoportal_geoportal-2.9rc10.dist-info → c2cgeoportal_geoportal-2.9rc11.dist-info}/entry_points.txt +0 -0
- {c2cgeoportal_geoportal-2.9rc10.dist-info → c2cgeoportal_geoportal-2.9rc11.dist-info}/top_level.txt +0 -0
@@ -661,7 +661,7 @@ def includeme(config: pyramid.config.Configurator) -> None:
|
|
661
661
|
pregenerator=C2CPregenerator(role=True),
|
662
662
|
request_method="POST",
|
663
663
|
)
|
664
|
-
# The
|
664
|
+
# The two next views are used to serve the application on the URL /mapserv_proxy/<ogc server name>
|
665
665
|
# instead of /mapserv_proxy?ogcserver=<ogc server name>, required for QGIS server landing page
|
666
666
|
config.add_route(
|
667
667
|
"mapserverproxy_get_path",
|
@@ -677,6 +677,21 @@ def includeme(config: pyramid.config.Configurator) -> None:
|
|
677
677
|
pregenerator=C2CPregenerator(role=True),
|
678
678
|
request_method="POST",
|
679
679
|
)
|
680
|
+
# OGC Api routes
|
681
|
+
config.add_route(
|
682
|
+
"mapserverproxy_ogcapi_mapserver",
|
683
|
+
"/mapserv_proxy/{ogcserver}/ogcapi/*path",
|
684
|
+
mapserverproxy=True,
|
685
|
+
pregenerator=C2CPregenerator(role=True),
|
686
|
+
request_method="GET",
|
687
|
+
)
|
688
|
+
config.add_route(
|
689
|
+
"mapserverproxy_ogcapi_qgisserver",
|
690
|
+
"/mapserv_proxy/{ogcserver}/wfs3/*path",
|
691
|
+
mapserverproxy=True,
|
692
|
+
pregenerator=C2CPregenerator(role=True),
|
693
|
+
request_method="GET",
|
694
|
+
)
|
680
695
|
add_cors_route(config, "/mapserv_proxy", "mapserver")
|
681
696
|
|
682
697
|
# Add route to the tinyows proxy
|
@@ -82,6 +82,8 @@ services:
|
|
82
82
|
environment:
|
83
83
|
- PGOPTIONS
|
84
84
|
- MAPSERVER_CONFIG_FILE=/etc/mapserver/mapserver.conf
|
85
|
+
- MAPSERVER_BASE_PATH=/mapserv_proxy
|
86
|
+
- OGCAPI_HTML_TEMPLATE_DIRECTORY=/usr/local/share/mapserver/ogcapi/templates/html-bootstrap4/
|
85
87
|
- AWS_ACCESS_KEY_ID
|
86
88
|
- AWS_SECRET_ACCESS_KEY
|
87
89
|
- AWS_DEFAULT_REGION
|
@@ -17,12 +17,47 @@ import requests
|
|
17
17
|
("https://front/c2c/health_check", {"checker": "check_collector"}, 2),
|
18
18
|
("https://front/admin/layertree", {}, 10),
|
19
19
|
("https://front/admin/layertree/children", {}, 10),
|
20
|
-
(
|
20
|
+
(
|
21
|
+
"http://mapserver:8080/mapserv_proxy/mapserver",
|
22
|
+
{"SERVICE": "WMS", "REQUEST": "GetCapabilities"},
|
23
|
+
60,
|
24
|
+
),
|
21
25
|
(
|
22
26
|
"https://front/mapserv_proxy",
|
23
|
-
{"ogcserver": "
|
27
|
+
{"ogcserver": "mapserver", "SERVICE": "WMS", "REQUEST": "GetCapabilities"},
|
24
28
|
60,
|
25
29
|
),
|
30
|
+
# (
|
31
|
+
# "http://qgisserver:8080/mapserv_proxy/",
|
32
|
+
# {"SERVICE": "WMS", "REQUEST": "GetCapabilities", "MAP": "/etc/qgisserver/project.qgs"},
|
33
|
+
# 60,
|
34
|
+
# ),
|
35
|
+
# (
|
36
|
+
# "https://front/mapserv_proxy",
|
37
|
+
# {"ogcserver": "qgisserver", "SERVICE": "WMS", "REQUEST": "GetCapabilities"},
|
38
|
+
# 60,
|
39
|
+
# ),
|
40
|
+
# OGC API - Features
|
41
|
+
# (
|
42
|
+
# "http://mapserver:8080/mapserv_proxy/mapserver/ogcapi/collections/osm_protected/items",
|
43
|
+
# {"bbox": "6.0,46.0,7.0,47.0", "limit": "100"},
|
44
|
+
# 60,
|
45
|
+
# ),
|
46
|
+
# (
|
47
|
+
# "https://front/mapserv_proxy/mapserver/mapserver/ogcapi/collections/osm_open/items",
|
48
|
+
# {"bbox": "6.0,46.0,7.0,47.0", "limit": "100"},
|
49
|
+
# 60,
|
50
|
+
# ),
|
51
|
+
# (
|
52
|
+
# "http://qgisserver:8080/mapserv_proxy/qgisserver/wfs3/collections/points/items",
|
53
|
+
# {"map": "/etc/qgisserver/project.qgs", "bbox": "6.0,46.0,7.0,47.0", "limit": "100"},
|
54
|
+
# 60,
|
55
|
+
# ),
|
56
|
+
# (
|
57
|
+
# "https://front/mapserv_proxy/qgisserver/wfs3/collections/points/items",
|
58
|
+
# {"bbox": "6.0,46.0,7.0,47.0", "limit": "100"},
|
59
|
+
# 60,
|
60
|
+
# ),
|
26
61
|
],
|
27
62
|
)
|
28
63
|
def test_url(url: str, params: dict[str, str], timeout: int) -> None:
|
@@ -55,20 +55,25 @@ def main() -> None:
|
|
55
55
|
)
|
56
56
|
|
57
57
|
interfaces = session.query(Interface).all()
|
58
|
-
|
58
|
+
ogc_jpeg = session.query(OGCServer).filter(OGCServer.name == "source for image/jpeg").one()
|
59
|
+
session.delete(ogc_jpeg)
|
60
|
+
|
61
|
+
ogc_server_mapserver = session.query(OGCServer).filter(OGCServer.name == "source for image/png").one()
|
62
|
+
ogc_server_mapserver.name = "mapserver"
|
63
|
+
ogc_server_mapserver.url = "config://mapserver/mapserv_proxy/mapserver?map=mapserver"
|
59
64
|
|
60
65
|
layer_borders = LayerWMS("Borders", "borders")
|
61
66
|
layer_borders.interfaces = interfaces
|
62
|
-
layer_borders.ogc_server =
|
67
|
+
layer_borders.ogc_server = ogc_server_mapserver
|
63
68
|
layer_density = LayerWMS("Density", "density")
|
64
69
|
layer_density.interfaces = interfaces
|
65
|
-
layer_density.ogc_server =
|
70
|
+
layer_density.ogc_server = ogc_server_mapserver
|
66
71
|
|
67
|
-
|
68
|
-
|
72
|
+
group_mapserver = LayerGroup("MapServer")
|
73
|
+
group_mapserver.children = [layer_borders, layer_density]
|
69
74
|
|
70
75
|
theme = Theme("Demo")
|
71
|
-
theme.children = [
|
76
|
+
theme.children = [group_mapserver]
|
72
77
|
theme.interfaces = interfaces
|
73
78
|
|
74
79
|
session.add(theme)
|
@@ -74,24 +74,7 @@ class MapservProxy(OGCProxy):
|
|
74
74
|
# GetFeatureInfo requests. For GetLegendGraphic requests we do not send layer_name, but MapServer
|
75
75
|
# should not use the DATA string for GetLegendGraphic.
|
76
76
|
|
77
|
-
|
78
|
-
self.params["role_ids"] = ",".join([str(e) for e in get_roles_id(self.request)])
|
79
|
-
|
80
|
-
# In some application we want to display the features owned by a user than we need his id.
|
81
|
-
self.params["user_id"] = self.user.id if self.user is not None else "-1"
|
82
|
-
|
83
|
-
# Do not allows direct variable substitution
|
84
|
-
for k in list(self.params.keys()):
|
85
|
-
if len(k) > 1 and k[:2].capitalize() == "S_":
|
86
|
-
_LOG.warning("Direct substitution not allowed (%s=%s).", k, self.params[k])
|
87
|
-
del self.params[k]
|
88
|
-
|
89
|
-
if (
|
90
|
-
self.ogc_server.auth == main.OGCSERVER_AUTH_STANDARD
|
91
|
-
and self.ogc_server.type == main.OGCSERVER_TYPE_MAPSERVER
|
92
|
-
):
|
93
|
-
# Add functionalities params
|
94
|
-
self.params.update(get_mapserver_substitution_params(self.request))
|
77
|
+
self._setup_auth()
|
95
78
|
|
96
79
|
# Get method
|
97
80
|
method = self.request.method
|
@@ -165,6 +148,70 @@ class MapservProxy(OGCProxy):
|
|
165
148
|
|
166
149
|
return response
|
167
150
|
|
151
|
+
def _setup_auth(self) -> None:
|
152
|
+
if self.ogc_server.auth == main.OGCSERVER_AUTH_STANDARD:
|
153
|
+
self.params["role_ids"] = ",".join([str(e) for e in get_roles_id(self.request)])
|
154
|
+
|
155
|
+
# In some application we want to display the features owned by a user than we need his id.
|
156
|
+
self.params["user_id"] = self.user.id if self.user is not None else "-1"
|
157
|
+
|
158
|
+
# Do not allows direct variable substitution
|
159
|
+
for k in list(self.params.keys()):
|
160
|
+
if len(k) > 1 and k[:2].capitalize() == "S_":
|
161
|
+
_LOG.warning("Direct substitution not allowed (%s=%s).", k, self.params[k])
|
162
|
+
del self.params[k]
|
163
|
+
|
164
|
+
if (
|
165
|
+
self.ogc_server.auth == main.OGCSERVER_AUTH_STANDARD
|
166
|
+
and self.ogc_server.type == main.OGCSERVER_TYPE_MAPSERVER
|
167
|
+
):
|
168
|
+
# Add functionalities params
|
169
|
+
self.params.update(get_mapserver_substitution_params(self.request))
|
170
|
+
|
171
|
+
@view_config(route_name="mapserverproxy_ogcapi_mapserver") # type: ignore
|
172
|
+
def proxy_ogcapi_mapserver(self) -> Response:
|
173
|
+
return self.proxy_ogcapi("ogcapi")
|
174
|
+
|
175
|
+
@view_config(route_name="mapserverproxy_ogcapi_qgisserver") # type: ignore
|
176
|
+
def proxy_ogcapi_qgisserver(self) -> Response:
|
177
|
+
return self.proxy_ogcapi("wfs3")
|
178
|
+
|
179
|
+
def proxy_ogcapi(self, subpath: str) -> Response:
|
180
|
+
self._setup_auth()
|
181
|
+
|
182
|
+
use_cache = False
|
183
|
+
|
184
|
+
errors: set[str] = set()
|
185
|
+
|
186
|
+
_url = self._get_wfs_url(errors)
|
187
|
+
if _url is not None:
|
188
|
+
_url.path = "/".join([_url.path.rstrip("/"), subpath, *self.request.matchdict["path"]])
|
189
|
+
_LOG.warning("URL: %s", _url)
|
190
|
+
_LOG.warning(self.request.matchdict)
|
191
|
+
|
192
|
+
if _url is None:
|
193
|
+
_LOG.error("Error getting the URL:\n%s", "\n".join(errors))
|
194
|
+
raise HTTPInternalServerError()
|
195
|
+
|
196
|
+
cache_control = Cache.PRIVATE_NO
|
197
|
+
|
198
|
+
headers = self.get_headers()
|
199
|
+
# Add headers for Geoserver
|
200
|
+
if self.ogc_server.auth == main.OGCSERVER_AUTH_GEOSERVER and self.user is not None:
|
201
|
+
headers["sec-username"] = self.user.username
|
202
|
+
headers["sec-roles"] = ";".join(get_roles_name(self.request))
|
203
|
+
|
204
|
+
response = self._proxy_callback(
|
205
|
+
cache_control,
|
206
|
+
url=_url,
|
207
|
+
params=self.params,
|
208
|
+
cache=use_cache,
|
209
|
+
headers=headers,
|
210
|
+
body=self.request.body,
|
211
|
+
)
|
212
|
+
|
213
|
+
return response
|
214
|
+
|
168
215
|
def _proxy_callback(
|
169
216
|
self, cache_control: Cache, url: Url, params: dict[str, str], **kwargs: Any
|
170
217
|
) -> Response:
|
{c2cgeoportal_geoportal-2.9rc10.dist-info → c2cgeoportal_geoportal-2.9rc11.dist-info}/RECORD
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
c2cgeoportal_geoportal/__init__.py,sha256=
|
1
|
+
c2cgeoportal_geoportal/__init__.py,sha256=Te7K9wopbz8ehFtjy_OW30BnTg5Sk_XD94Gws_1740M,39215
|
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
|
@@ -68,7 +68,7 @@ c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/Makefile,sha256
|
|
68
68
|
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/README.rst,sha256=QJcaUtT05atb5x8SJYflSt0YIJkbAz0Zh39_FYtyFks,423
|
69
69
|
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/build,sha256=CjYe1cIL-TsKPbdxy1zStTUEGguILXpyUC63X2_Cy8c,7010
|
70
70
|
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/docker-compose-db.yaml,sha256=sNzJxDQX54WfKgJhhVhDm4a05z3Rz1j6Oocl1QHzeyQ,518
|
71
|
-
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/docker-compose-lib.yaml,sha256=
|
71
|
+
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/docker-compose-lib.yaml,sha256=VdRZO71CRtmyBzhUXXtwZ1HBpLPT_58BhQUFKKgxkeI,13680
|
72
72
|
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/docker-compose-qgis.yaml,sha256=YE44s31kI79j5ypud4RS69sSDGFH1ROHNNAkyWxZ4jk,576
|
73
73
|
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/docker-compose.override.sample.yaml,sha256=4gsJGJi-yoxmHuQy1B-E5HKKq9LyzBuRcKaBoP7G1_0,2529
|
74
74
|
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/docker-compose.yaml,sha256=ZpQ33JhdBxkoUNBV9kB5f07p8DpqgvJ3-Mp0SzLnJ6w,2380
|
@@ -132,7 +132,7 @@ c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/qgisserver/pg_s
|
|
132
132
|
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/scripts/db-backup,sha256=48fii_o6y9VbAb-ToG9qU0flS6kEXk6lfHsgtufgrwg,5205
|
133
133
|
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/scripts/db-restore,sha256=dfOEwiN8us_JulAZCEgM9WyqHUWEbnlowOgm5nQ0NR8,5425
|
134
134
|
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
135
|
-
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/tests/test_app.py,sha256=
|
135
|
+
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/tests/test_app.py,sha256=uleNaLIMz9gKXVl8ZF_pkqKVaY4o9-LUdUogrXY7I7Y,2971
|
136
136
|
c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/tilegeneration/config.yaml.tmpl,sha256=OK6ZFMlYMx1wcx8leK42LA8p0P56HuEAP8fupuxDI34,6181
|
137
137
|
c2cgeoportal_geoportal/scaffolds/update/cookiecutter.json,sha256=x3FFn3b67GPGCsjg36iGXCudjaTSfwGHcwHS6HHVpPQ,539
|
138
138
|
c2cgeoportal_geoportal/scaffolds/update/{{cookiecutter.project}}/.upgrade.yaml,sha256=8tPCziX4Wh6a2EOdjpLtvyqNtKcI7Rtjo8-bLQO8_Gg,2741
|
@@ -142,7 +142,7 @@ c2cgeoportal_geoportal/scaffolds/update/{{cookiecutter.project}}/geoportal/CONST
|
|
142
142
|
c2cgeoportal_geoportal/scaffolds/update/{{cookiecutter.project}}/geoportal/CONST_vars.yaml,sha256=eafKkn_K87pXrtX1pGoEav3_1ELz3oiGLviNEV6vkOI,49133
|
143
143
|
c2cgeoportal_geoportal/scripts/__init__.py,sha256=hHwjhQaM_T2EaupeFIyjl0N67Bcl3M99UMcCdYAjQlQ,2929
|
144
144
|
c2cgeoportal_geoportal/scripts/c2cupgrade.py,sha256=7smnq2yxs1hAF1CiyE9WfgAqNKjjtrtHevY321i-wio,36826
|
145
|
-
c2cgeoportal_geoportal/scripts/create_demo_theme.py,sha256=
|
145
|
+
c2cgeoportal_geoportal/scripts/create_demo_theme.py,sha256=4S3WPfwzIV4j1LYGYHD1KHDEfVXMfI_iEafNcxqC37A,3423
|
146
146
|
c2cgeoportal_geoportal/scripts/manage_users.py,sha256=Ih3X_V_xUw59Ums4a1x6qQQtz9VtE7PaxAj-tiZIOPg,5586
|
147
147
|
c2cgeoportal_geoportal/scripts/pcreate.py,sha256=1zy-khluuf2gnqA_hJAFy6HFBxDdrqf-__iSZx4R9rs,11588
|
148
148
|
c2cgeoportal_geoportal/scripts/theme2fts.py,sha256=Tx1jUfDUwNtwZ5TCyfpldZIbIkzZiQ3dq-kv_YQ9yFE,13737
|
@@ -159,7 +159,7 @@ c2cgeoportal_geoportal/views/geometry_processing.py,sha256=6dNDjl09mEKGZwJ3ZZkEC
|
|
159
159
|
c2cgeoportal_geoportal/views/i18n.py,sha256=RUuH_HPyjQrij8tfjlketSdRZkE_fpZzgtFq4jSKCr4,5331
|
160
160
|
c2cgeoportal_geoportal/views/layers.py,sha256=aEF2Z-eG6bP6B8aSl653wY7BcM7UDMYpSsf_yta_yBM,29178
|
161
161
|
c2cgeoportal_geoportal/views/login.py,sha256=s17aSGm-RnmOns9X1etTXjDBMSnJI3HkaaUX8AOKe_s,28833
|
162
|
-
c2cgeoportal_geoportal/views/mapserverproxy.py,sha256=
|
162
|
+
c2cgeoportal_geoportal/views/mapserverproxy.py,sha256=MIhhKymJnd22G8g_vchRQeUM6Kj_JQMQKcA7dx4KGdE,9704
|
163
163
|
c2cgeoportal_geoportal/views/memory.py,sha256=ttkX7DVcnlA1KsTtQEGZv66qGbjVFbeJGbrvxp6uh04,3748
|
164
164
|
c2cgeoportal_geoportal/views/ogcproxy.py,sha256=2i3cuZ2cRybEH-DvAQbrLnUxd9y3B0iKnwkpaJvhwSc,5215
|
165
165
|
c2cgeoportal_geoportal/views/pdfreport.py,sha256=nJ_V4Z74YHtYFw1ZIAJer8iz5KMedHPPbgBUy2qkpCU,9616
|
@@ -185,8 +185,8 @@ tests/test_mapserverproxy_route_predicate.py,sha256=SzILSSzIuilzIkUYVPZiVzLwW1du
|
|
185
185
|
tests/test_raster.py,sha256=82NJ2MXgZlMqs0ytN-VgNw376iURdk4PkAg__dyh5ns,11948
|
186
186
|
tests/test_wmstparsing.py,sha256=xjA8nJuXFl3H5Bfs4sJw_8qX8E8qvAALK7Hs2-DTP2A,9054
|
187
187
|
tests/xmlstr.py,sha256=rkTKSU4FGjupBKLx75H8o-goB0KbQrxDvdpc6xVX_uQ,5985
|
188
|
-
c2cgeoportal_geoportal-2.
|
189
|
-
c2cgeoportal_geoportal-2.
|
190
|
-
c2cgeoportal_geoportal-2.
|
191
|
-
c2cgeoportal_geoportal-2.
|
192
|
-
c2cgeoportal_geoportal-2.
|
188
|
+
c2cgeoportal_geoportal-2.9rc11.dist-info/METADATA,sha256=eYjUQAmiBf6Ny6ETtc2qcJAX45ctlFyb5HDstOe8s24,1886
|
189
|
+
c2cgeoportal_geoportal-2.9rc11.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
190
|
+
c2cgeoportal_geoportal-2.9rc11.dist-info/entry_points.txt,sha256=3dnX260FsLX_AubeNMdyeta_z1X4CxcD3steAlfPx2I,1414
|
191
|
+
c2cgeoportal_geoportal-2.9rc11.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
|
192
|
+
c2cgeoportal_geoportal-2.9rc11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{c2cgeoportal_geoportal-2.9rc10.dist-info → c2cgeoportal_geoportal-2.9rc11.dist-info}/top_level.txt
RENAMED
File without changes
|