mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-20 07:43:35 -05:00
Merge pull request #13573 from john-westcott-iv/ldap_issue
Fixing LDAP users not being properly added to managed teams
This commit is contained in:
@@ -385,10 +385,10 @@ def on_populate_user(sender, **kwargs):
|
|||||||
logger.warning('LDAP user {} has {} > max {} characters'.format(user.username, field, max_len))
|
logger.warning('LDAP user {} has {} > max {} characters'.format(user.username, field, max_len))
|
||||||
|
|
||||||
org_map = getattr(backend.settings, 'ORGANIZATION_MAP', {})
|
org_map = getattr(backend.settings, 'ORGANIZATION_MAP', {})
|
||||||
team_map = getattr(backend.settings, 'TEAM_MAP', {})
|
team_map_settings = getattr(backend.settings, 'TEAM_MAP', {})
|
||||||
orgs_list = list(org_map.keys())
|
orgs_list = list(org_map.keys())
|
||||||
team_map = {}
|
team_map = {}
|
||||||
for team_name, team_opts in team_map.items():
|
for team_name, team_opts in team_map_settings.items():
|
||||||
if not team_opts.get('organization', None):
|
if not team_opts.get('organization', None):
|
||||||
# You can't save the LDAP config in the UI w/o an org (or '' or null as the org) so if we somehow got this condition its an error
|
# You can't save the LDAP config in the UI w/o an org (or '' or null as the org) so if we somehow got this condition its an error
|
||||||
logger.error("Team named {} in LDAP team map settings is invalid due to missing organization".format(team_name))
|
logger.error("Team named {} in LDAP team map settings is invalid due to missing organization".format(team_name))
|
||||||
@@ -416,7 +416,7 @@ def on_populate_user(sender, **kwargs):
|
|||||||
|
|
||||||
# Compute in memory what the state is of the different LDAP teams
|
# Compute in memory what the state is of the different LDAP teams
|
||||||
desired_team_states = {}
|
desired_team_states = {}
|
||||||
for team_name, team_opts in team_map.items():
|
for team_name, team_opts in team_map_settings.items():
|
||||||
if 'organization' not in team_opts:
|
if 'organization' not in team_opts:
|
||||||
continue
|
continue
|
||||||
users_opts = team_opts.get('users', None)
|
users_opts = team_opts.get('users', None)
|
||||||
|
|||||||
Reference in New Issue
Block a user