Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
newswangerd committed Sep 12, 2024
1 parent 81c91e3 commit 50bf6b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ansible_base/authentication/authenticator_plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ def move_authenticator_user_to(self, new_user, old_authenticator_user):
"authenticator_users",
"groups",
"has_roles",
# We're ignoring role assignments for two reasons: 1. this isn't safe to copy right now, as it
# could break the caching layer, 2. roles are intented to come from the authenticator via an
# authenticator map, so when a user is move to a new authenticator, they're old roles should
# be removed.
"role_assignments",
"logentry",
)

old_user = old_authenticator_user.user
Expand Down
2 changes: 2 additions & 0 deletions ansible_base/authentication/utils/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def migrate_from_existing_authenticator(
old_user = from_authenticator.move_authenticator_user_to(main_user, migrate_user)
if old_user and not old_user.authenticator_users.exists():
old_user.delete()
else:
logger.warning(f"{old_user.username} is still managed by other authenticators and cannot be deleted.")

# Now that we've potentially cleaned up any old user accounts, lets see if we can
# give the user their preferred_username as their username
Expand Down

0 comments on commit 50bf6b3

Please sign in to comment.