Skip to content

Commit

Permalink
:recyle: [#4246] Rename python attribute to better name
Browse files Browse the repository at this point in the history
The value will need to be updated too, but that will involve some
migrations and import shims to update the prefill configuration.
  • Loading branch information
sergei-maertens committed Jul 2, 2024
1 parent ba61561 commit d23d5cf
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.11 on 2024-07-02 06:33

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("forms", "0101_objecttype_url_to_uuid"),
]

operations = [
migrations.AlterField(
model_name="formvariable",
name="prefill_identifier_role",
field=models.CharField(
choices=[("main", "Main"), ("authorised_person", "Authorizee")],
default="main",
help_text="In case that multiple identifiers are returned (in the case of eHerkenning bewindvoering and DigiD Machtigen), should the prefill data related to the main identifier be used, or that related to the authorised person?",
max_length=100,
verbose_name="prefill identifier role",
),
),
]
7 changes: 6 additions & 1 deletion src/openforms/prefill/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@

class IdentifierRoles(models.TextChoices):
main = "main", _("Main")
authorised_person = "authorised_person", _("Authorised person")
# TODO: this value is wrongly named:
# 1. authorised person only applies for DigiD machtigen
# 2. with eHerkenning (bewindvoering), the authorizee is de *company* (legal
# subject). For the acting subject, we only get an opaque, encrypted identifier
# that cannot be used to prefill information (this is by design).
authorizee = "authorised_person", _("Authorizee")
2 changes: 1 addition & 1 deletion src/openforms/prefill/contrib/haalcentraal_brp/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_identifier_value(
):
return submission.auth_info.value

if identifier_role == IdentifierRoles.authorised_person:
if identifier_role == IdentifierRoles.authorizee:
return submission.auth_info.machtigen.get("identifier_value")

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_prefill_values_for_gemachtigde(self):
values = plugin.get_prefill_values(
submission,
attributes=[Attributes.naam_voornamen, Attributes.naam_geslachtsnaam],
identifier_role=IdentifierRoles.authorised_person,
identifier_role=IdentifierRoles.authorizee,
)

self.assertEqual(
Expand Down
2 changes: 1 addition & 1 deletion src/openforms/prefill/contrib/stufbg/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def get_identifier_value(
):
return submission.auth_info.value

if identifier_role == IdentifierRoles.authorised_person:
if identifier_role == IdentifierRoles.authorizee:
return submission.auth_info.machtigen.get("identifier_value")

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion src/openforms/prefill/contrib/stufbg/tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def test_get_available_attributes_for_gemachtigde(self):
)

values = self.plugin.get_prefill_values(
submission, attributes, IdentifierRoles.authorised_person
submission, attributes, IdentifierRoles.authorizee
)

self.assertEqual(values["bsn"], "999992314")
Expand Down
6 changes: 3 additions & 3 deletions src/openforms/prefill/tests/test_prefill_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def test_fetch_values_with_multiple_people(self, m_haal_centraal):
"prefill": {
"plugin": "haalcentraal",
"attribute": "naam.geslachtsnaam",
"identifierRole": IdentifierRoles.authorised_person,
"identifierRole": IdentifierRoles.authorizee,
},
},
]
Expand Down Expand Up @@ -185,7 +185,7 @@ def test_fetch_values_with_legal_entity_and_person(self, m_kvk, m_haal_centraal)
"prefill": {
"plugin": "haalcentraal",
"attribute": "naam.geslachtsnaam",
"identifier": IdentifierRoles.authorised_person,
"identifier": IdentifierRoles.authorizee,
},
},
{
Expand All @@ -194,7 +194,7 @@ def test_fetch_values_with_legal_entity_and_person(self, m_kvk, m_haal_centraal)
"prefill": {
"plugin": "haalcentraal",
"attribute": "naam.voornamen",
"identifier": IdentifierRoles.authorised_person,
"identifier": IdentifierRoles.authorizee,
},
},
]
Expand Down

0 comments on commit d23d5cf

Please sign in to comment.