mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 08:37:48 -02:30
more efficiently determine saml team mapping
This commit is contained in:
@@ -186,12 +186,15 @@ def update_user_teams_by_saml_attr(backend, details, user=None, *args, **kwargs)
|
||||
if team_map.get('saml_attr') is None:
|
||||
return
|
||||
|
||||
attr_values = kwargs.get('response', {}).get('attributes', {}).get(team_map['saml_attr'], [])
|
||||
saml_team_names = set(kwargs
|
||||
.get('response', {})
|
||||
.get('attributes', {})
|
||||
.get(team_map['saml_attr'], []))
|
||||
|
||||
team_ids = []
|
||||
for team_name in attr_values:
|
||||
for team_name_map in team_map.get('team_org_map', []):
|
||||
if team_name_map.get('team', '') == team_name:
|
||||
team_name = team_name_map.get('team', '')
|
||||
if team_name in saml_team_names:
|
||||
if multiple_orgs:
|
||||
if not team_name_map.get('organization', ''):
|
||||
# Settings field validation should prevent this.
|
||||
|
||||
Reference in New Issue
Block a user