From 45772158bc8aad4c07fa78fb3ce638f18b2370df Mon Sep 17 00:00:00 2001
From: Talia <trhodes@edx.org>
Date: Fri, 23 Jul 2021 14:17:28 -0400
Subject: [PATCH] feat: add boolean field to third_party_auth to be used to
 remove providers from enterprise selection

---
 .../migrations/0005_auto_20210723_1527.py     | 28 +++++++++++++++++++
 common/djangoapps/third_party_auth/models.py  | 10 +++++++
 requirements/constraints.txt                  |  2 +-
 requirements/edx/base.txt                     |  2 +-
 requirements/edx/development.txt              |  2 +-
 requirements/edx/testing.txt                  |  2 +-
 6 files changed, 42 insertions(+), 4 deletions(-)
 create mode 100644 common/djangoapps/third_party_auth/migrations/0005_auto_20210723_1527.py

diff --git a/common/djangoapps/third_party_auth/migrations/0005_auto_20210723_1527.py b/common/djangoapps/third_party_auth/migrations/0005_auto_20210723_1527.py
new file mode 100644
index 00000000000..ff525632ee5
--- /dev/null
+++ b/common/djangoapps/third_party_auth/migrations/0005_auto_20210723_1527.py
@@ -0,0 +1,28 @@
+# Generated by Django 2.2.24 on 2021-07-23 15:27
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('third_party_auth', '0004_auto_20200919_0955'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='ltiproviderconfig',
+            name='disable_for_enterprise_sso',
+            field=models.BooleanField(default=False, help_text='IDPs with this set to True will be excluded from the dropdown IDP selection in the EnterpriseCustomer Django Admin form.', verbose_name='Disabled for Enterprise TPA'),
+        ),
+        migrations.AddField(
+            model_name='oauth2providerconfig',
+            name='disable_for_enterprise_sso',
+            field=models.BooleanField(default=False, help_text='IDPs with this set to True will be excluded from the dropdown IDP selection in the EnterpriseCustomer Django Admin form.', verbose_name='Disabled for Enterprise TPA'),
+        ),
+        migrations.AddField(
+            model_name='samlproviderconfig',
+            name='disable_for_enterprise_sso',
+            field=models.BooleanField(default=False, help_text='IDPs with this set to True will be excluded from the dropdown IDP selection in the EnterpriseCustomer Django Admin form.', verbose_name='Disabled for Enterprise TPA'),
+        ),
+    ]
diff --git a/common/djangoapps/third_party_auth/models.py b/common/djangoapps/third_party_auth/models.py
index 9036be1a926..25b0cc31ca6 100644
--- a/common/djangoapps/third_party_auth/models.py
+++ b/common/djangoapps/third_party_auth/models.py
@@ -212,6 +212,16 @@ class ProviderConfig(ConfigurationModel):
         default=False,
         help_text="Use the presence of a profile from a trusted third party as proof of identity verification.",
     )
+
+    disable_for_enterprise_sso = models.BooleanField(
+        default=False,
+        verbose_name='Disabled for Enterprise TPA',
+        help_text=_(
+            "IDPs with this set to True will be excluded from the dropdown IDP selection "
+            "in the EnterpriseCustomer Django Admin form."
+        )
+    )
+
     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
diff --git a/requirements/constraints.txt b/requirements/constraints.txt
index be4bb20797a..1aadc178a4b 100644
--- a/requirements/constraints.txt
+++ b/requirements/constraints.txt
@@ -36,7 +36,7 @@ django-storages<1.9
 # The team that owns this package will manually bump this package rather than having it pulled in automatically.
 # This is to allow them to better control its deployment and to do it in a process that works better
 # for them.
-edx-enterprise==3.27.3
+edx-enterprise==3.27.6
 
 # Newer versions need a more recent version of python-dateutil
 freezegun==0.3.12
diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt
index 67aecb8ca1d..39b7bea0f34 100644
--- a/requirements/edx/base.txt
+++ b/requirements/edx/base.txt
@@ -435,7 +435,7 @@ edx-drf-extensions==6.6.0
     #   edx-rbac
     #   edx-when
     #   edxval
-edx-enterprise==3.27.3
+edx-enterprise==3.27.6
     # via
     #   -c requirements/edx/../constraints.txt
     #   -r requirements/edx/base.in
diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt
index 6139689f2bc..475661dfdf1 100644
--- a/requirements/edx/development.txt
+++ b/requirements/edx/development.txt
@@ -528,7 +528,7 @@ edx-drf-extensions==6.6.0
     #   edx-rbac
     #   edx-when
     #   edxval
-edx-enterprise==3.27.3
+edx-enterprise==3.27.6
     # via
     #   -c requirements/edx/../constraints.txt
     #   -r requirements/edx/testing.txt
diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt
index 141ea80fbf1..8bc502d8cfb 100644
--- a/requirements/edx/testing.txt
+++ b/requirements/edx/testing.txt
@@ -511,7 +511,7 @@ edx-drf-extensions==6.6.0
     #   edx-rbac
     #   edx-when
     #   edxval
-edx-enterprise==3.27.3
+edx-enterprise==3.27.6
     # via
     #   -c requirements/edx/../constraints.txt
     #   -r requirements/edx/base.txt
-- 
GitLab