Read policies from an external file and add a reload trigger endpoint. #274

Merged
cmo merged 4 commits from external-mapping into master 2026-10-02 12:03:13 +00:00
Owner

Support loading of policy information from an URL.

The collection configuration may contain a default location for policy information.

A new endpoint (requires CURATOR-token):

GET /management/reload/policy_info/{collection}?url

allows to trigger loading of a collection from a URL. If the optional parameter url is provided, the policy-configuration will be loaded from there. Otherwise, if a default location is configured in the configuration, the policy information will be loaded from the default configuration.

Newly loaded policy information will become effective immediately.

Support loading of policy information from an URL. The collection configuration may contain a default location for policy information. A new endpoint (requires CURATOR-token): ``` GET /management/reload/policy_info/{collection}?url ``` allows to trigger loading of a collection from a URL. If the optional parameter `url` is provided, the policy-configuration will be loaded from there. Otherwise, if a default location is configured in the configuration, the policy information will be loaded from the default configuration. Newly loaded policy information will become effective immediately.
This commit removes the configuration keys:

- default_policy
- policy_annotation_tag
- policy_mapping

and adds the key:

- policy_info_location

The key `policy_info_location` optionally contain
a URL from which policy information is read.

The commit also adds the endpoint

GET /management/reload/policy_info/{collection}

The endpoint allows to reload policy information
from either the configured location of from a
location given in the query-parameter `url`.

The endpoint requires a CURATOR-token.

Policy information is a JSON-representation
of a `dump-things-service.abstract_config.PolicyInfo`
object. For example:

{
  "default_policy": "abc:policy_abc",
  "policy_annotation_tag": "https://example.org/dumpthings/policy_set",
  "policy_mapping": [
    {
      "auth_source": "config",
      "user_id": "user_all",
      "authorized_by": [
        "abc:policy_abc",
        "policy_1"
      ]
    },
    {
      "auth_source": "some_other_source",
      "user_id": "test_user_2",
      "authorized_by": [
        "https://examples.com/policy_example_2",
        "abc:policy_def"
      ]
    }
  ]
}
refactor: return an empty body when reloading policies
Some checks failed
Codespell / Check for spelling errors (push) Failing after 27s
Ruff / Code linting (push) Failing after 35s
Test execution / Test-all (push) Successful in 1m13s
9aaf65d2d3
doc: update documentation on policies
Some checks failed
Codespell / Check for spelling errors (push) Failing after 28s
Ruff / Code linting (push) Failing after 34s
Test execution / Test-all (push) Successful in 1m13s
Codespell / Check for spelling errors (pull_request) Failing after 27s
Ruff / Code linting (pull_request) Failing after 33s
Type annotation (PR) / check (pull_request) Has been cancelled
042d8e4a8e
Describe the policy reference mechanism, the
structure of a policy information file and
the policy reload endpoint.
refactor: reformat code, remove unused imports
Some checks failed
Codespell / Check for spelling errors (push) Failing after 43s
Codespell / Check for spelling errors (pull_request) Failing after 49s
Ruff / Code linting (pull_request) Successful in 52s
Ruff / Code linting (push) Successful in 57s
Type annotation (PR) / check (pull_request) Failing after 1m11s
Test execution / Test-all (push) Successful in 1m26s
f039adc321
cmo merged commit 5c813d7e87 into master 2026-10-02 12:03:13 +00:00
cmo deleted branch external-mapping 2026-10-02 12:03:25 +00:00
Sign in to join this conversation.
No description provided.