-
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.
Merge pull request #4339 from open-formulieren/feature/4246-store-aut…
…hentication-context-data 🗃️ [#4246] Expand AuthInfo model to capture mandate context
- Loading branch information
Showing
4 changed files
with
285 additions
and
11 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
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
103 changes: 103 additions & 0 deletions
103
src/openforms/authentication/migrations/0002_add_authentication_context_mandate_fields.py
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,103 @@ | ||
# Generated by Django 4.2.11 on 2024-05-31 07:13 | ||
|
||
from django.db import migrations, models | ||
import openforms.authentication.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("of_authentication", "0001_initial_to_openforms_v230"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="authinfo", | ||
name="acting_subject_identifier_type", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[("opaque", "Opaque")], | ||
help_text="The identifier type determines how to interpret the identifier value.", | ||
max_length=50, | ||
verbose_name="acting subject identifier type", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="authinfo", | ||
name="acting_subject_identifier_value", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="(Contextually) unique identifier for the acting subject.", | ||
max_length=250, | ||
verbose_name="acting subject identifier", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="authinfo", | ||
name="legal_subject_identifier_type", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[("bsn", "BSN"), ("kvk", "KvK number"), ("rsin", "RSIN")], | ||
help_text="The identifier type determines how to interpret the identifier value.", | ||
max_length=50, | ||
verbose_name="legal subject identifier type", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="authinfo", | ||
name="legal_subject_identifier_value", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="(Contextually) unique identifier for the legal subject.", | ||
max_length=250, | ||
verbose_name="legal subject identifier", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="authinfo", | ||
name="mandate_context", | ||
field=models.JSONField( | ||
blank=True, | ||
help_text="If a mandate is in play, then the mandate context must be provided. The details are tracked here, in line with the authentication context data JSON schema definition.", | ||
null=True, | ||
verbose_name="mandate context", | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name="authinfo", | ||
constraint=openforms.authentication.models.ConjointConstraint( | ||
fields=( | ||
"acting_subject_identifier_type", | ||
"acting_subject_identifier_value", | ||
), | ||
name="acting_subject_integrity", | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name="authinfo", | ||
constraint=openforms.authentication.models.ConjointConstraint( | ||
fields=( | ||
"legal_subject_identifier_type", | ||
"legal_subject_identifier_value", | ||
), | ||
name="legal_subject_integrity", | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name="authinfo", | ||
constraint=models.CheckConstraint( | ||
check=models.Q( | ||
models.Q( | ||
("legal_subject_identifier_value", ""), | ||
("mandate_context__isnull", True), | ||
), | ||
models.Q( | ||
models.Q(("legal_subject_identifier_value", ""), _negated=True), | ||
("mandate_context__isnull", False), | ||
), | ||
_connector="OR", | ||
), | ||
name="mandate_context_not_null", | ||
), | ||
), | ||
] |
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