Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(models): allow blank #1979

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions benefits/core/migrations/0006_alter_allow_blank.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Generated by Django 5.0.3 on 2024-03-25 19:48

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("core", "0005_move_help_template_to_eligibilityverifier"),
]

operations = [
migrations.AlterField(
model_name="authprovider",
name="claim",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="authprovider",
name="scope",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="authprovider",
name="sign_out_button_template",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="authprovider",
name="sign_out_link_template",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="eligibilityverifier",
name="api_auth_header",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="eligibilityverifier",
name="api_url",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="eligibilityverifier",
name="auth_provider",
field=models.ForeignKey(
blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to="core.authprovider"
),
),
migrations.AlterField(
model_name="eligibilityverifier",
name="form_class",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="eligibilityverifier",
name="help_template",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="eligibilityverifier",
name="jwe_cek_enc",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="eligibilityverifier",
name="jwe_encryption_alg",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="eligibilityverifier",
name="jws_signing_alg",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="eligibilityverifier",
name="public_key",
field=models.ForeignKey(
blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name="+", to="core.pemdata"
),
),
migrations.AlterField(
model_name="eligibilityverifier",
name="start_template",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="pemdata",
name="remote_url",
field=models.TextField(blank=True, null=True),
),
]
34 changes: 17 additions & 17 deletions benefits/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ class PemData(models.Model):
# Human description of the PEM data
label = models.TextField()
# The name of a secret with data in utf-8 encoded PEM text format
text_secret_name = SecretNameField(null=True)
text_secret_name = SecretNameField(null=True, blank=True)
# Public URL hosting the utf-8 encoded PEM text
remote_url = models.TextField(null=True)
remote_url = models.TextField(null=True, blank=True)

def __str__(self):
return self.label
Expand Down Expand Up @@ -81,13 +81,13 @@ class AuthProvider(models.Model):
"""An entity that provides authentication for eligibility verifiers."""

id = models.AutoField(primary_key=True)
sign_out_button_template = models.TextField(null=True)
sign_out_link_template = models.TextField(null=True)
sign_out_button_template = models.TextField(null=True, blank=True)
sign_out_link_template = models.TextField(null=True, blank=True)
client_name = models.TextField()
client_id_secret_name = SecretNameField()
authority = models.TextField()
scope = models.TextField(null=True)
claim = models.TextField(null=True)
scope = models.TextField(null=True, blank=True)
claim = models.TextField(null=True, blank=True)
scheme = models.TextField()

@property
Expand Down Expand Up @@ -160,24 +160,24 @@ class EligibilityVerifier(models.Model):
name = models.TextField()
display_order = models.PositiveSmallIntegerField(default=0, blank=False, null=False)
active = models.BooleanField(default=False)
api_url = models.TextField(null=True)
api_auth_header = models.TextField(null=True)
api_auth_key_secret_name = SecretNameField(null=True)
api_url = models.TextField(null=True, blank=True)
api_auth_header = models.TextField(null=True, blank=True)
api_auth_key_secret_name = SecretNameField(null=True, blank=True)
eligibility_type = models.ForeignKey(EligibilityType, on_delete=models.PROTECT)
# public key is used to encrypt requests targeted at this Verifier and to verify signed responses from this verifier
public_key = models.ForeignKey(PemData, related_name="+", on_delete=models.PROTECT, null=True)
public_key = models.ForeignKey(PemData, related_name="+", on_delete=models.PROTECT, null=True, blank=True)
# The JWE-compatible Content Encryption Key (CEK) key-length and mode
jwe_cek_enc = models.TextField(null=True)
jwe_cek_enc = models.TextField(null=True, blank=True)
# The JWE-compatible encryption algorithm
jwe_encryption_alg = models.TextField(null=True)
jwe_encryption_alg = models.TextField(null=True, blank=True)
# The JWS-compatible signing algorithm
jws_signing_alg = models.TextField(null=True)
auth_provider = models.ForeignKey(AuthProvider, on_delete=models.PROTECT, null=True)
jws_signing_alg = models.TextField(null=True, blank=True)
auth_provider = models.ForeignKey(AuthProvider, on_delete=models.PROTECT, null=True, blank=True)
selection_label_template = models.TextField()
start_template = models.TextField(null=True)
start_template = models.TextField(null=True, blank=True)
# reference to a form class used by this Verifier, e.g. benefits.app.forms.FormClass
form_class = models.TextField(null=True)
help_template = models.TextField(null=True)
form_class = models.TextField(null=True, blank=True)
help_template = models.TextField(null=True, blank=True)

class Meta:
ordering = ["display_order"]
Expand Down
Loading