Skip to content

Commit

Permalink
Incorporate X-Forwarded-Prefix into metadata.comparison_url key of Ge…
Browse files Browse the repository at this point in the history
…t Workspace Map
  • Loading branch information
index-git authored and jirik committed Aug 30, 2023
1 parent d1dd0be commit 3c57e03
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- [#765](https://github.com/LayerManager/layman/issues/765) Fix `issuer_id` value in `users` table that was broken since v1.21.0.
- [#765](https://github.com/LayerManager/layman/issues/765) Remove `authn.txt` files from workspace directories. The same information as in `authn.txt` files is saved in prime DB schema.
### Changes
- [#868](https://github.com/LayerManager/layman/issues/868) Endpoints [GET Publications](doc/rest.md#get-publications), [GET Layers](doc/rest.md#get-layers), [GET Workspace Layers](doc/rest.md#get-workspace-layers) and [GET Maps](doc/rest.md#get-maps) [GET Workspace Maps](doc/rest.md#get-workspace-maps) respects [HTTP header `X-Forwarded-Prefix`](doc/client-proxy.md#x-forwarded-prefix-http-header) of the request in response in `url` key. Endpoint [GET Workspace Layer](doc/rest.md#get-workspace-layer) respects it in `url`, `thumbnail`.`url`, `metadata`.`comparison_url`, `wms`.`url`, `wfs`.`url` and `style`.`url` keys. Endpoint [GET Workspace Map](doc/rest.md#get-workspace-map) respects it in `url`, `file`.`url` and `thumbnail`.`url` keys.
- [#868](https://github.com/LayerManager/layman/issues/868) Endpoints [GET Publications](doc/rest.md#get-publications), [GET Layers](doc/rest.md#get-layers), [GET Workspace Layers](doc/rest.md#get-workspace-layers) and [GET Maps](doc/rest.md#get-maps) [GET Workspace Maps](doc/rest.md#get-workspace-maps) respects [HTTP header `X-Forwarded-Prefix`](doc/client-proxy.md#x-forwarded-prefix-http-header) of the request in response in `url` key. Endpoint [GET Workspace Layer](doc/rest.md#get-workspace-layer) respects it in `url`, `thumbnail`.`url`, `metadata`.`comparison_url`, `wms`.`url`, `wfs`.`url` and `style`.`url` keys. Endpoint [GET Workspace Map](doc/rest.md#get-workspace-map) respects it in `url`, `file`.`url`, `thumbnail`.`url` and `metadata`.`comparison_url` keys.
- [#880](https://github.com/LayerManager/layman/issues/880) Use Docker Compose v2 (`docker compose`) in Makefile without `compatibility` flag and remove `Makefile_docker-compose_v1` file. Docker containers are named according to Docker Compose v2 and may have different name after upgrade.
- [#765](https://github.com/LayerManager/layman/issues/765) Stop saving OAuth2 claims in filesystem, use prime DB schema only.
- [#893](https://github.com/LayerManager/layman/issues/893) It is possible to specify logging level by new environment variable [LAYMAN_LOGLEVEL](doc/env-settings.md#LAYMAN_LOGLEVEL). Default level is `INFO`.
Expand Down
1 change: 1 addition & 0 deletions doc/client-proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ Currently, value of `X-Forwarded-Prefix` affects following URLs:
* `url` key
* `file`.`url` key
* `thumbnail`.`url` key
* `metadata`.`comparison_url` key
5 changes: 3 additions & 2 deletions src/layman/map/micka/csw.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
post_map = empty_method


def get_map_info(workspace, mapname):
def get_map_info(workspace, mapname, *, x_forwarded_prefix=None):
uuid = get_map_uuid(workspace, mapname)
try:
csw = common_util.create_csw()
Expand All @@ -46,7 +46,8 @@ def get_map_info(workspace, mapname):
'identifier': muuid,
'csw_url': settings.CSW_PROXY_URL,
'record_url': common_util.get_metadata_url(uuid, url_type=common_util.RecordUrlType.BASIC),
'comparison_url': url_for('rest_workspace_map_metadata_comparison.get', workspace=workspace, mapname=mapname),
'comparison_url': url_for('rest_workspace_map_metadata_comparison.get', workspace=workspace, mapname=mapname,
x_forwarded_prefix=x_forwarded_prefix),
}
}
return {}
Expand Down
1 change: 1 addition & 0 deletions tests/asserts/final/publication/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,4 @@ def get_map_with_x_forwarded_prefix(workspace, name, headers, ):
assert rest_map_info['url'] == f'http://{settings.LAYMAN_PROXY_SERVER_NAME}{proxy_prefix}/rest/workspaces/{workspace}/maps/{name}'
assert rest_map_info['file']['url'] == f'http://{settings.LAYMAN_PROXY_SERVER_NAME}{proxy_prefix}/rest/workspaces/{workspace}/maps/{name}/file'
assert rest_map_info['thumbnail']['url'] == f'http://{settings.LAYMAN_PROXY_SERVER_NAME}{proxy_prefix}/rest/workspaces/{workspace}/maps/{name}/thumbnail'
assert rest_map_info['metadata']['comparison_url'] == f'http://{settings.LAYMAN_PROXY_SERVER_NAME}{proxy_prefix}/rest/workspaces/{workspace}/maps/{name}/metadata-comparison'

0 comments on commit 3c57e03

Please sign in to comment.