-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#4396] Added basic structure of the Objects API prefill plugin
This commit contains only the basic structure of the plugin, the methods will be implemented in the next PR. This has the endpoints and views needed for the new prefill modal when we select the ObjectsAPI.
- Loading branch information
Showing
11 changed files
with
329 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ Prefill plugins | |
kvk | ||
stuf_bg | ||
suwinet | ||
objects_api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.. _configuration_prefill_objects_api: | ||
|
||
=========== | ||
Objects API | ||
=========== | ||
|
||
`Objects API`_ can store objects which are defined (their schema and properties) in the `Objecttypes API`_. | ||
With this prefill plugin we can have components/form fields which have pre-filled the values taken from the Objects API. | ||
|
||
.. note:: | ||
|
||
This service contains sensitive data and requires a connection to a specific | ||
client system. The forms which make use of this prefill plugin require DigiD/Eherkenning authentication | ||
of the user. | ||
|
||
.. _`Objects API`: https://objects-and-objecttypes-api.readthedocs.io/en/latest/ | ||
.. _`Objecttypes API`: https://objects-and-objecttypes-api.readthedocs.io/en/latest/ | ||
|
||
|
||
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: | ||
|
||
* **Plugin**: *Choose the Objects API plugin* | ||
* **API Group**: *Choose the desired API Group * | ||
(There must be at least one added-configured via **Miscellaneous** > **Objects API groups**) | ||
* **Objecttype**: *Based on the selected API group above, you can choose the objecttype from the auto populated list* | ||
* **Mappings**: *On the left we have the available form variables and on the right the available attributes which are | ||
defined in the selected objecttype's schema properties. You can do the mappings accordingly* | ||
|
||
7. Click **Save** | ||
8. Save the form | ||
|
||
The Objects API configuration is now complete. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
""" | ||
Objects API prefill plugin. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.apps import AppConfig | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
|
||
class ObjectsApiApp(AppConfig): | ||
name = "openforms.prefill.contrib.objects_api" | ||
label = "objects_api" | ||
verbose_name = _("Objects API prefill plugin") | ||
|
||
def ready(self): | ||
# register the plugin | ||
from . import plugin # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import logging | ||
from typing import Any, Iterable | ||
|
||
from django.utils.translation import gettext_lazy as _ | ||
|
||
from openforms.authentication.service import AuthAttribute | ||
from openforms.submissions.models import Submission | ||
from openforms.typing import JSONEncodable | ||
|
||
from ...base import BasePlugin | ||
from ...constants import IdentifierRoles | ||
from ...registry import register | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
PLUGIN_IDENTIFIER = "objects_api" | ||
|
||
|
||
@register(PLUGIN_IDENTIFIER) | ||
class ObjectsAPIPrefill(BasePlugin): | ||
verbose_name = _("Objects API") | ||
requires_auth = AuthAttribute.bsn | ||
|
||
@staticmethod | ||
def get_available_attributes( | ||
reference: dict[str, Any] | None = None, | ||
) -> Iterable[tuple[str, str]]: | ||
pass | ||
|
||
@classmethod | ||
def get_prefill_values( | ||
cls, | ||
submission: Submission, | ||
attributes: list[str], | ||
identifier_role: IdentifierRoles = IdentifierRoles.main, | ||
) -> dict[str, JSONEncodable]: | ||
pass | ||
|
||
@classmethod | ||
def get_co_sign_values( | ||
cls, submission: Submission, identifier: str | ||
) -> tuple[dict[str, Any], str]: | ||
pass |