Skip to content

Commit

Permalink
????
Browse files Browse the repository at this point in the history
No-Issue

Signed-off-by: James Tanner <[email protected]>
  • Loading branch information
jctanner committed Sep 12, 2024
1 parent 99344c8 commit 4f7f131
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions galaxy_ng/app/dynaconf_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,26 +551,26 @@ def configure_authentication_backends(settings: Dynaconf) -> Dict[str, Any]:
based on the value of AUTHENTICATION_BACKEND_PRESET the installer should set.
For AAP user migration scenarios (https://github.com/ansible/django-ansible-base/pull/611),
the PrefixedUserAuthBackend must always be first in the list.
the PrefixedUserAuthBackend should always be last in the list.
"""

data = {}

# default data
backends = settings.get("AUTHENTICATION_BACKENDS", [])

# insert prefix stuff
prefix_backend = "ansible_base.lib.backends.prefixed_user_auth.PrefixedUserAuthBackend"
if prefix_backend not in backends:
backends.insert(0, prefix_backend)

# Load preset data
preset_name = settings.get("AUTHENTICATION_BACKEND_PRESET")
if (preset_list := settings.AUTHENTICATION_BACKEND_PRESETS_DATA.get(preset_name)) is not None:
for item in preset_list:
if item not in backends:
backends.append(item)

# insert prefix stuff
prefix_backend = "ansible_base.lib.backends.prefixed_user_auth.PrefixedUserAuthBackend"
if prefix_backend not in backends:
backend.append(prefix_backend)

# deduplicate dynaconf_merge ...
if backends.count('dynaconf_merge'):
backends = [x for x in backends if x != 'dynconf_merge']
Expand Down

0 comments on commit 4f7f131

Please sign in to comment.