From 5313020da8618f4b0ef67bec9e45dcf2965d8828 Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Wed, 3 Jul 2024 11:17:31 +0200 Subject: [PATCH] :card_file_box: [#3967] Add model field to store service restriction (branch number) --- ...al_subject_service_restriction_and_more.py | 23 +++++++++++++++++++ src/openforms/authentication/models.py | 12 +++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/openforms/authentication/migrations/0003_authinfo_legal_subject_service_restriction_and_more.py diff --git a/src/openforms/authentication/migrations/0003_authinfo_legal_subject_service_restriction_and_more.py b/src/openforms/authentication/migrations/0003_authinfo_legal_subject_service_restriction_and_more.py new file mode 100644 index 0000000000..2c3ccdc8e6 --- /dev/null +++ b/src/openforms/authentication/migrations/0003_authinfo_legal_subject_service_restriction_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.11 on 2024-07-03 09:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("of_authentication", "0002_add_authentication_context_mandate_fields"), + ] + + operations = [ + migrations.AddField( + model_name="authinfo", + name="legal_subject_service_restriction", + field=models.CharField( + blank=True, + help_text="Optional service restriction information within the bigger legal subject.", + max_length=250, + verbose_name="legal subject service restriction", + ), + ), + ] diff --git a/src/openforms/authentication/models.py b/src/openforms/authentication/models.py index c7c43cddcf..b626bf1a86 100644 --- a/src/openforms/authentication/models.py +++ b/src/openforms/authentication/models.py @@ -183,6 +183,16 @@ class AuthInfo(BaseAuthInfo): max_length=250, blank=True, ) + # generic field for "service restriction", but in practice this means + # vestiging/branch number for eHerkenning. + legal_subject_service_restriction = models.CharField( + verbose_name=_("legal subject service restriction"), + help_text=_( + "Optional service restriction information within the bigger legal subject." + ), + max_length=250, # the 250 is quite arbitrary, branch number is 12 chars + blank=True, + ) mandate_context = models.JSONField( verbose_name=_("mandate context"), @@ -230,7 +240,7 @@ class Meta: "legal_subject_identifier_value", ), ), - # presence of a legal subject implies a mandata context + # presence of a legal subject implies a mandate context models.CheckConstraint( name="mandate_context_not_null", check=(