From 679b2c6b74d9ed3e966f0a84f4196a22230e1b04 Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Fri, 13 Dec 2024 15:10:45 +0100 Subject: [PATCH] :pencil: Update technical configuration documentation for Objects API * Updated some outdated registration plugin docs * Structured the prefill docs the same way It's important to separate the upfront technical configuration (aimed at technical administrators) from the manual which describes how to use the feature. Another commit will add the functional user manual documentation as an example form. --- docs/configuration/index.rst | 13 +- docs/configuration/prefill/objects_api.rst | 142 +++++++++++++----- docs/configuration/registration/objects.rst | 15 +- .../conf/locale/nl/LC_MESSAGES/django.po | 2 +- .../prefill/contrib/objects_api/plugin.py | 12 +- 5 files changed, 126 insertions(+), 58 deletions(-) diff --git a/docs/configuration/index.rst b/docs/configuration/index.rst index 21c88b05a9..a766afeae8 100644 --- a/docs/configuration/index.rst +++ b/docs/configuration/index.rst @@ -7,20 +7,25 @@ There are many configuration options in Open Forms. Some of these are included in the core of Open Forms, and some are included by plugins. We cover various configuration topics that come with Open Forms by default. -Initial configuration ---------------------- - Open Forms supports the ``setup_configuration`` management command, which allows loading configuration via YAML files. The shape of these files is described at :ref:`installation_configuration_cli`. +Initial configuration +--------------------- + .. toctree:: :maxdepth: 2 general/index +Plugins +------- + +Many of the plugins in Open Forms require some technical configuration before you can +use them in forms. The technical requirements are grouped by functionality module. + .. toctree:: :maxdepth: 2 - :caption: Plugins authentication/index payment/index diff --git a/docs/configuration/prefill/objects_api.rst b/docs/configuration/prefill/objects_api.rst index 8760846f71..04e5e47b23 100644 --- a/docs/configuration/prefill/objects_api.rst +++ b/docs/configuration/prefill/objects_api.rst @@ -1,59 +1,127 @@ -.. todo:: This feature is still in development and not ready for production yet. - .. _configuration_prefill_objects_api: =========== Objects API =========== -The `Objects API`_ stores data records of which the structure and shape are defined by a particular object type -definition in the `Objecttypes API`_. These records can be used to pre-fill form fields if an object reference is -passed when the form is started. +*This plugin is also known as the "product prefill" feature.* + +The `Objects API`_ stores data records of which the structure and shape are defined by a +particular object type definition in the `Objecttypes API`_. These records can be used +to pre-fill form fields if an object reference is passed when the form is started. .. note:: - The service may contain sensitive data. It is advised to require DigiD/eHerkenning authentication on the form. You - should be careful with how you pass the object references to the customers and set up the object type in a way that - makes authentication checks possible (e.g. by storing the expected BSN or KVK number). + The service likely contains sensitive data. It is required to use authentication on + the form, as this information is used to test ownership of the referenced object. -.. _`Objects API`: https://objects-and-objecttypes-api.readthedocs.io/en/latest/ -.. _`Objecttypes API`: https://objects-and-objecttypes-api.readthedocs.io/en/latest/ +What does the Open Forms administrator need? +============================================ +* An instance of the `Objecttypes API`_ with: + + - an API token to access the API from Open Forms + - one or more objecttypes + +* An instance of the `Objects API`_ (v2.2+) with: + + - (API) access to the above Objecttypes API + - an API token to access the Objects API from Open Forms + - read permissions for the relevant Objecttypes - Open Forms reads records. Configuration ============= -1. In Open Forms, navigate to: **Forms** -2. Click **Add form** -3. Define the necessary form details and add the desired components -4. Navigate to: **Variables** tab -5. Navigate to: **User defined** subtab -6. Click **Add variable** and fill in the data from the available options: +Configuration is similar to :ref:`its registration counterpart `, +but only the objecttypes and objects services are required. - * **Plugin**: Choose the *Objects API* plugin - * **API Group**: Select the appropriate API group. These API groups should be set up - by an administrator, via **Admin** > **Configuration** > **Prefill plugins** > - **Objects API** > **Manage API groups** - * **Objecttype**: Select the expected object type from the dropdown. - * **Mappings**: Configure which property from the Objects API record needs to be - assigned to which form variable. +.. tip:: You can re-use the same API groups that are used for the registration plugin. - For each form variable you want to pre-fill, add a new mapping. Then, on the left - select the desired form variable, and on the right you can specify which property - from the object type contains the value. +To configure the Objects API follow these steps: -7. Click **Save** -8. Save the form +#. In Open Forms, navigate to: **Configuration** > **Services** +#. Create a service for the Objects API (ORC) where the form data will be registered. -The Objects API configuration is now complete. + a. Click **Service toevoegen**. + b. Fill out the form: -.. note:: + * **Label**: *Fill in a human readable label*, for example: ``My Objects API`` + * **Type**: Select the type: ``ORC`` + * **API root url**: The root of this API, *for example* ``https://example.com/objecten/api/v2/`` + + * **Authorization type**: Select the option: ``API Key`` + * **Header key**: Fill in ``Authorization`` + * **Header value**: Fill in ``Token `` where ```` is replaced by the token provided by the backend service + * **OAS**: URL that points to the OAS, same URL as used for **API root url** with ``/schema/openapi.yaml`` added to it + *for example:* ``https://example.com/objecten/api/v1/schema/openapi.yaml`` + + * **NLX**: Support for NLX can be selected here if enabled in the installation + + c. Click **Opslaan** and repeat to create configuration for the other component. + +#. Create a service for the Objecttypes API (ORC). + + a. Click **Service toevoegen**. + b. Fill out the form: + + * **Label**: *Fill in a human readable label*, for example: ``My Objecttypes API`` + * **Type**: Select the type: ``ORC`` + * **API root url**: The root of this API, *for example* ``https://example.com/objecttypen/api/v2/`` + + * **Authorization type**: Select the option: ``API Key`` + * **Header key**: Fill in ``Authorization`` + * **Header value**: Fill in ``Token `` where ```` is replaced by the token provided by the backend service + * **OAS**: URL that points to the OAS, same URL as used for **API root url** with ``/schema/openapi.yaml`` added to it + *for example:* ``https://example.com/objecttypen/api/v1/schema/openapi.yaml`` - The Objects API prefill can be used not only for prefilling and showing the data to the user, - but it can also work together with the Objects API registration plugin - (see :ref:`Objects API configuration (English) `) in order to make - modifications to an existing object in the Objects API. This requires the form user to be the "owner" - of the object and the necessary configuration in the Objects API registration at the form level - (by choosing to update the existing object). + * **NLX**: Support for NLX can be selected here if enabled in the installation - .. image:: _assets/update_existing_object.png + c. Click **Opslaan** and repeat to create configuration for the other component. + +#. Navigate to **Configuration** > **Overview**. In the **Prefill plugins** group, + click on **Manage API groups** for the **Objects API** line. + +#. Enter the following details: + + * **Name**: Enter a recognizable name, it will be displayed in various dropdowns. + * **Objects API**: Select the Objects API (ORC) service created above + * **Objecttypes API**: Select the Objecttypes API (ORC) service created above + + The remainer of the fields can be left empty. + +#. Click **Save** + +The Objects API configuration is now complete and can be selected as prefill backend in +the form builder. When doing so, you will be able to select the desired object type and +its version. + +Recommendations for the Objecttype JSON Schemas +=============================================== + +The same recommendation apply as for the +:ref:`registration plugin `. We +rely heavily on the JSON Schema specified in the object type. + +Technical +========= + +Open Forms requires Objects API v2.2 or newer and the Objecttypes API v2.0 or newer. + +================ =============================================== +Objects API Test status +================ =============================================== +2.2.x Manually verified +2.3.x Manually verified +2.4.x Manually verified, automated end-to-end testing +================ =============================================== + +================ =============================================== +Objecttypes API Test status +================ =============================================== +2.0.x Unknown +2.1.x Manually verified +2.2.x Manually verified, automated end-to-end testing +================ =============================================== + +.. _`Objects API`: https://objects-and-objecttypes-api.readthedocs.io/en/latest/ +.. _`Objecttypes API`: https://objects-and-objecttypes-api.readthedocs.io/en/latest/ diff --git a/docs/configuration/registration/objects.rst b/docs/configuration/registration/objects.rst index ea9b235a5f..e21f65e36b 100644 --- a/docs/configuration/registration/objects.rst +++ b/docs/configuration/registration/objects.rst @@ -127,15 +127,22 @@ To configure the Objects API follow these steps: * **User ID**: Audit trail user ID, usually same as the Client ID * **User representation**: *For example:* ``Open Forms`` -#. Navigate to **Configuration** > **Overview**. In the **Registration plugin** group, - click on **Configuration** for the **Objects API registratie** line. +#. Navigate to **Configuration** > **Overview**. In the **Registration plugins** group, + click on **Manage API groups** for the **Objects API registratie** line. #. Enter the following details: + * **Name**: Enter a recognizable name, it will be displayed in various dropdowns. * **Objects API**: Select the Objects API (ORC) service created above * **Objecttypes API**: Select the Objecttypes API (ORC) service created above * **Documenten API**: Select the Documenten API (DRC) service created above * **Catalogi API**: Select the Zaaktypecatalogus (ZTC) service created above + * **Organisatie RSIN**: Fill the RSIN to use as "bronorganisatie" in Document uploads. + *For example:* ``123456789``. You an override this on a per-form basis. + + The following fields are deprecated - it's better to specify a catalogue and the + description of the document types instead. + * **Submission report informatieobjecttype**: Fill in the default URL of the INFORMATIEOBJECTTYPE for the submission report in the Catalogi API *For example* ``https://example.com/api/v1/informatieobjecttypen/1/``. You an override this on a @@ -150,8 +157,6 @@ To configure the Objects API follow these steps: INFORMATIEOBJECTTYPE for the submission attachments in the Catalogi API *For example* ``https://example.com/api/v1/informatieobjecttypen/3/``. You an override this on a per-form and per-file component basis. - * **Organisatie RSIN**: Fill the RSIN to use as "bronorganisatie" in Document uploads. - *For example:* ``123456789``. You an override this on a per-form basis. For the legacy configuration format, additional fields are available: @@ -176,7 +181,7 @@ When doing so, the corresponding objecttype and objecttype version will have to .. _configuration_registration_objects_objecttype_tips: Recommendations for the Objecttype JSON Schemas -================================================ +=============================================== The objecttype definition uses `JSON Schema `_, and this schema is processed by Open Forms. diff --git a/src/openforms/conf/locale/nl/LC_MESSAGES/django.po b/src/openforms/conf/locale/nl/LC_MESSAGES/django.po index 2833b36a78..687b86e928 100644 --- a/src/openforms/conf/locale/nl/LC_MESSAGES/django.po +++ b/src/openforms/conf/locale/nl/LC_MESSAGES/django.po @@ -11663,7 +11663,7 @@ msgstr "Geeft aan of gevoelige gegevens verwijders zijn van deze inzending." #: openforms/submissions/models/submission.py:263 msgid "initial data reference" -msgstr "ongeldige data-referentie" +msgstr "startdata-referentie" #: openforms/submissions/models/submission.py:266 msgid "" diff --git a/src/openforms/prefill/contrib/objects_api/plugin.py b/src/openforms/prefill/contrib/objects_api/plugin.py index 6414f02172..ee710fd688 100644 --- a/src/openforms/prefill/contrib/objects_api/plugin.py +++ b/src/openforms/prefill/contrib/objects_api/plugin.py @@ -9,7 +9,6 @@ from openforms.contrib.objects_api.clients import get_objects_client from openforms.contrib.objects_api.models import ObjectsAPIGroupConfig from openforms.contrib.objects_api.ownership_validation import validate_object_ownership -from openforms.registrations.contrib.objects_api.models import ObjectsAPIConfig from openforms.submissions.models import Submission from openforms.typing import JSONEncodable, JSONObject @@ -73,16 +72,7 @@ def get_config_actions(self): return [ ( _("Manage API groups"), - reverse( - "admin:registrations_objects_api_objectsapigroupconfig_changelist" - ), - ), - ( - _("Defaults configuration"), - reverse( - "admin:registrations_objects_api_objectsapiconfig_change", - args=(ObjectsAPIConfig.singleton_instance_id,), - ), + reverse("admin:objects_api_objectsapigroupconfig_changelist"), ), ]