From 40561c9ad749047afefa0f0eaeb6fa8cbff17198 Mon Sep 17 00:00:00 2001 From: Jiri Kozel Date: Wed, 30 Sep 2020 18:43:51 +0200 Subject: [PATCH] Release 1.7.1 (#111) - Use Layman Test Client v1.3.0 - Handle records without title in GET Layers / GET Maps, fix #109 - Return real SLD style in GET Layer Style instead of just metadata --- .env.demo | 2 +- .env.dev | 2 +- .env.test | 2 +- CHANGELOG.md | 11 +++++++++++ src/layman/layer/geoserver/sld.py | 10 +++++++--- src/layman/layer/rest_layer_style.py | 8 +------- src/layman/layer/rest_layers.py | 2 +- src/layman/map/rest_maps.py | 2 +- 8 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.env.demo b/.env.demo index 38fc3d2b4..931406421 100644 --- a/.env.demo +++ b/.env.demo @@ -48,7 +48,7 @@ LAYMAN_CLIENT_URL=http://layman_client:3000/client/ # client LAYMAN_CLIENT_PUBLIC_URL=http://localhost/client/ -LAYMAN_CLIENT_VERSION=v1.2.0 +LAYMAN_CLIENT_VERSION=v1.3.0 # extra hosts to be added to /etc/hosts EXTRA_HOST1=1.2.3.4:1.2.3.4 diff --git a/.env.dev b/.env.dev index b921ebf7c..d4ce4f9a9 100644 --- a/.env.dev +++ b/.env.dev @@ -50,7 +50,7 @@ LAYMAN_CLIENT_URL=http://layman_client:3000/client/ # client LAYMAN_CLIENT_PUBLIC_URL=http://localhost:3000/client/ -LAYMAN_CLIENT_VERSION=v1.2.0 +LAYMAN_CLIENT_VERSION=v1.3.0 ############################################################################## diff --git a/.env.test b/.env.test index 71be448a8..37bcbd10d 100644 --- a/.env.test +++ b/.env.test @@ -50,7 +50,7 @@ LAYMAN_CLIENT_URL=http://layman_client_test:3000/client/ # client LAYMAN_CLIENT_PUBLIC_URL=http://layman_test_run_1:8000/client/ -LAYMAN_CLIENT_VERSION=v1.2.0 +LAYMAN_CLIENT_VERSION=v1.3.0 ############################################################################## diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f6bd2fba..72ca43286 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,21 @@ # Changelog +## v1.7.1 +2020-09-30 +### Upgrade requirements +- Change [LAYMAN_CLIENT_VERSION](doc/env-settings.md#LAYMAN_CLIENT_VERSION) to `v1.3.0` + - If you are running Layman with development settings, run also `make client-build`. +### Changes +- Test Client contains also GET Layer Style endpoint. +- Return real SLD style in GET Layer Style instead of just metadata +- [#109](https://github.com/jirik/layman/issues/109) Handle records without title in GET Layers / GET Maps + ## v1.7.0 2020-09-30 ### Upgrade requirements - [#65](https://github.com/jirik/layman/issues/65) Set environment variable [LAYMAN_GS_AUTHN_HTTP_HEADER_ATTRIBUTE](doc/env-settings.md#LAYMAN_GS_AUTHN_HTTP_HEADER_ATTRIBUTE). Only combination of lowercase characters and numbers must be used for the value. - [#101](https://github.com/jirik/layman/issues/101) Change [LAYMAN_CLIENT_VERSION](doc/env-settings.md#LAYMAN_CLIENT_VERSION) from `v1.1.2` to `v1.2.0` + - If you are running Layman with development settings, run also `make client-build`. ### Changes - [#65](https://github.com/jirik/layman/issues/65) [WFS endpoint](doc/rest.md#get-layer) accepts same [authentication](doc/security.md#authentication) credentials (e.g. [OAuth2 headers](doc/oauth2/index.md#request-layman-rest-api)) as Layman REST API endpoints. It's implemented using Layman's WFS proxy. This proxy authenticates the user and send user identification to GeoServer. In combination with changes in v1.6.0, Layman's [`read-everyone-write-owner` authorization](doc/security.md#authorization) (when active) is propagated to GeoServer and user can change only hers layers. - [#88](https://github.com/jirik/layman/issues/88) Attribute **title** was added to REST endpoints [GET Layers](doc/rest.md#get-layers) and [GET Maps](doc/rest.md#get-maps). diff --git a/src/layman/layer/geoserver/sld.py b/src/layman/layer/geoserver/sld.py index de79cf733..749fc743c 100644 --- a/src/layman/layer/geoserver/sld.py +++ b/src/layman/layer/geoserver/sld.py @@ -13,12 +13,16 @@ from layman import settings, patch_mode from layman.common import util as layman_util from . import headers_json -from . import headers_json, headers_xml from . import wms from ...util import url_for PATCH_MODE = patch_mode.DELETE_IF_DEPENDANT +headers_sld = { + 'Accept': 'application/vnd.ogc.sld+xml', + 'Content-type': 'application/xml', +} + def update_layer(username, layername, layerinfo): pass @@ -57,7 +61,7 @@ def delete_layer(username, layername): def get_layer_info(username, layername): - r = get_style_response(username, layername, headers_xml, settings.LAYMAN_GS_AUTH) + r = get_style_response(username, layername, headers_sld, settings.LAYMAN_GS_AUTH) if r.status_code == 200: url = url_for('rest_layer_style.get', username=username, layername=layername) info = { @@ -181,7 +185,7 @@ def get_metadata_comparison(username, layername): def get_style_response(username, stylename, headers=None, auth=None): if headers is None: - headers = headers_xml + headers = headers_sld url = settings.LAYMAN_GS_REST + f'workspaces/{username}/styles/{stylename}' r = requests.get(url, diff --git a/src/layman/layer/rest_layer_style.py b/src/layman/layer/rest_layer_style.py index 9595601de..c636e6623 100644 --- a/src/layman/layer/rest_layer_style.py +++ b/src/layman/layer/rest_layer_style.py @@ -9,11 +9,6 @@ bp = Blueprint('rest_layer_style', __name__) -headers_xml = { - 'Accept': 'application/xml', - 'Content-type': 'application/xml', -} - @bp.before_request @authenticate @@ -31,8 +26,7 @@ def get(username, layername): response = sld.get_style_response(username, layername, - headers_xml, - settings.LAYMAN_GS_AUTH) + auth=settings.LAYMAN_GS_AUTH) excluded_headers = ['content-encoding', 'content-length', 'transfer-encoding', 'connection'] headers = {key: value for (key, value) in response.headers.items() if key.lower() not in excluded_headers} diff --git a/src/layman/layer/rest_layers.py b/src/layman/layer/rest_layers.py index 0bde4ca52..21d891ade 100644 --- a/src/layman/layer/rest_layers.py +++ b/src/layman/layer/rest_layers.py @@ -32,7 +32,7 @@ def get(username): infos = [ { 'name': info["name"], - 'title': info["title"], + 'title': info.get("title", None), 'url': url_for('rest_layer.get', layername=name, username=username), 'uuid': info["uuid"], } diff --git a/src/layman/map/rest_maps.py b/src/layman/map/rest_maps.py index 2c5cd0dbc..88d988138 100644 --- a/src/layman/map/rest_maps.py +++ b/src/layman/map/rest_maps.py @@ -33,7 +33,7 @@ def get(username): infos = [ { 'name': name, - 'title': info['title'], + 'title': info.get("title", None), 'url': url_for('rest_map.get', mapname=name, username=name), 'uuid': info['uuid'], }