Skip to content

Commit

Permalink
🗃️ [#94] 'Rename' original fields
Browse files Browse the repository at this point in the history
Drop the old fields and rename the new ones to the old field names
  • Loading branch information
sergei-maertens committed May 1, 2024
1 parent 08802a3 commit c391ccb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
18 changes: 18 additions & 0 deletions mozilla_django_oidc_db/migrations/0002_migrate_to_claim_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,22 @@ class Migration(migrations.Migration):
),
),
migrations.RunPython(copy_forward, copy_reverse),
migrations.RemoveField(
model_name="openidconnectconfig",
name="groups_claim",
),
migrations.RemoveField(
model_name="openidconnectconfig",
name="username_claim",
),
migrations.RenameField(
model_name="openidconnectconfig",
old_name="new_groups_claim",
new_name="groups_claim",
),
migrations.RenameField(
model_name="openidconnectconfig",
old_name="new_username_claim",
new_name="username_claim",
),
]
19 changes: 2 additions & 17 deletions mozilla_django_oidc_db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,7 @@ class OpenIDConnectConfig(CachingMixin, OpenIDConnectConfigBase):
Configuration for authentication/authorization via OpenID connect
"""

username_claim = models.CharField(
_("username claim"),
max_length=50,
default="sub",
help_text=_("The name of the OIDC claim that is used as the username"),
)
new_username_claim = ClaimField(
username_claim = ClaimField(
verbose_name=_("username claim"),
default=get_default_username_claim,
help_text=_("The name of the OIDC claim that is used as the username"),
Expand All @@ -272,16 +266,7 @@ class OpenIDConnectConfig(CachingMixin, OpenIDConnectConfigBase):
default=get_claim_mapping,
help_text=("Mapping from user-model fields to OIDC claims"),
)
groups_claim = models.CharField(
_("groups claim"),
max_length=50,
default="roles",
help_text=_(
"The name of the OIDC claim that holds the values to map to local user groups."
),
blank=True,
)
new_groups_claim = ClaimField(
groups_claim = ClaimField(
verbose_name=_("groups claim"),
default=get_default_groups_claim,
help_text=_(
Expand Down

0 comments on commit c391ccb

Please sign in to comment.