diff --git a/mozilla_django_oidc_db/migrations/0006_alter_openidconnectconfig_default_groups.py b/mozilla_django_oidc_db/migrations/0006_alter_openidconnectconfig_default_groups.py new file mode 100644 index 0000000..7b0b6cc --- /dev/null +++ b/mozilla_django_oidc_db/migrations/0006_alter_openidconnectconfig_default_groups.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.17 on 2025-01-10 15:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("auth", "0012_alter_user_first_name_max_length"), + ("mozilla_django_oidc_db", "0005_alter_openidconnectconfig_claim_mapping"), + ] + + operations = [ + migrations.AlterField( + model_name="openidconnectconfig", + name="default_groups", + field=models.ManyToManyField( + blank=True, + default=list, + help_text="The default groups to which every user logging in with OIDC will be assigned", + to="auth.group", + verbose_name="default groups", + ), + ), + ] diff --git a/mozilla_django_oidc_db/models.py b/mozilla_django_oidc_db/models.py index 88ff404..c3281c2 100644 --- a/mozilla_django_oidc_db/models.py +++ b/mozilla_django_oidc_db/models.py @@ -288,6 +288,7 @@ class OpenIDConnectConfig(OpenIDConnectConfigBase): default_groups = models.ManyToManyField( Group, verbose_name=_("default groups"), + default=list, blank=True, help_text=_( "The default groups to which every user logging in with OIDC will be assigned" diff --git a/mozilla_django_oidc_db/setup_configuration/models.py b/mozilla_django_oidc_db/setup_configuration/models.py index ca4cd84..41bee05 100644 --- a/mozilla_django_oidc_db/setup_configuration/models.py +++ b/mozilla_django_oidc_db/setup_configuration/models.py @@ -91,9 +91,7 @@ class AdminOIDCConfigurationModelItem(ConfigurationModel): superuser_group_names: list[str] = DjangoModelRef( OpenIDConnectConfig, "superuser_group_names" ) - default_groups: list[str] = DjangoModelRef( - OpenIDConnectConfig, "superuser_group_names" - ) + default_groups: list[str] = DjangoModelRef(OpenIDConnectConfig, "default_groups") oidc_rp_scopes_list: list[str] = DjangoModelRef( OpenIDConnectConfig, "oidc_rp_scopes_list" )