From d852e38cba2ed9655bf11b3a03f5685e47ac5e0f Mon Sep 17 00:00:00 2001 From: Alexander Sheehan Date: Mon, 21 Mar 2022 10:37:50 -0400 Subject: [PATCH] feat: new is_valid field for provider configs --- .../0007_samlproviderconfig_was_valid_at.py | 18 ++++++++++++++++++ common/djangoapps/third_party_auth/models.py | 8 ++++++++ 2 files changed, 26 insertions(+) create mode 100644 common/djangoapps/third_party_auth/migrations/0007_samlproviderconfig_was_valid_at.py diff --git a/common/djangoapps/third_party_auth/migrations/0007_samlproviderconfig_was_valid_at.py b/common/djangoapps/third_party_auth/migrations/0007_samlproviderconfig_was_valid_at.py new file mode 100644 index 0000000000..06bc446277 --- /dev/null +++ b/common/djangoapps/third_party_auth/migrations/0007_samlproviderconfig_was_valid_at.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.12 on 2022-03-21 14:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('third_party_auth', '0006_auto_20220314_1551'), + ] + + operations = [ + migrations.AddField( + model_name='samlproviderconfig', + name='was_valid_at', + field=models.DateTimeField(blank=True, help_text='Timestamped field that indicates a user has successfully logged in using this configuration at least once.', null=True), + ), + ] diff --git a/common/djangoapps/third_party_auth/models.py b/common/djangoapps/third_party_auth/models.py index 1421767cb8..9686a756e2 100644 --- a/common/djangoapps/third_party_auth/models.py +++ b/common/djangoapps/third_party_auth/models.py @@ -700,6 +700,14 @@ class SAMLProviderConfig(ProviderConfig): blank=True, ) + was_valid_at = models.DateTimeField( + blank=True, + null=True, + help_text=( + "Timestamped field that indicates a user has successfully logged in using this configuration at least once." + ) + ) + def clean(self): """ Standardize and validate fields """ super().clean()