Merge pull request #30118 from openedx/asheehan-edx/adding-was-valid-at-to-provider-config
bug: adding was_valid_at to all provider configs
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 3.2.12 on 2022-03-24 14:22
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('third_party_auth', '0007_samlproviderconfig_was_valid_at'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='ltiproviderconfig',
|
||||
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),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='oauth2providerconfig',
|
||||
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),
|
||||
),
|
||||
]
|
||||
@@ -223,6 +223,14 @@ class ProviderConfig(ConfigurationModel):
|
||||
)
|
||||
)
|
||||
|
||||
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."
|
||||
)
|
||||
)
|
||||
|
||||
prefix = None # used for provider_id. Set to a string value in subclass
|
||||
backend_name = None # Set to a field or fixed value in subclass
|
||||
accepts_logins = True # Whether to display a sign-in button when the provider is enabled
|
||||
@@ -700,14 +708,6 @@ 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()
|
||||
|
||||
@@ -64,10 +64,11 @@ class Oauth2ProviderConfigAdminTest(testutil.TestCase):
|
||||
# Remove the icon_image from the POST data, to simulate unchanged icon_image
|
||||
post_data = models.model_to_dict(provider1)
|
||||
del post_data['icon_image']
|
||||
# Remove max_session_length and organization. A default null value must be POSTed
|
||||
# Remove max_session_length, was_valid_at and organization. A default null value must be POSTed
|
||||
# back as an absent value, rather than as a "null-like" included value.
|
||||
del post_data['max_session_length']
|
||||
del post_data['organization']
|
||||
del post_data['was_valid_at']
|
||||
|
||||
# Change the name, to verify POST
|
||||
post_data['name'] = 'Another name'
|
||||
|
||||
Reference in New Issue
Block a user