mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
Allow mapping org auditors where we map org admins.
This commit is contained in:
@@ -151,17 +151,20 @@ def update_user_orgs_by_saml_attr(backend, details, user=None, *args, **kwargs):
|
||||
return
|
||||
from django.conf import settings
|
||||
org_map = settings.SOCIAL_AUTH_SAML_ORGANIZATION_ATTR
|
||||
if org_map.get('saml_attr') is None and org_map.get('saml_admin_attr') is None:
|
||||
if org_map.get('saml_attr') is None and org_map.get('saml_admin_attr') is None and org_map.get('saml_auditor_attr') is None:
|
||||
return
|
||||
|
||||
remove = bool(org_map.get('remove', True))
|
||||
remove_admins = bool(org_map.get('remove_admins', True))
|
||||
remove_auditors = bool(org_map.get('remove_auditors', True))
|
||||
|
||||
attr_values = kwargs.get('response', {}).get('attributes', {}).get(org_map['saml_attr'], [])
|
||||
attr_admin_values = kwargs.get('response', {}).get('attributes', {}).get(org_map['saml_admin_attr'], [])
|
||||
attr_auditor_values = kwargs.get('response', {}).get('attributes', {}).get(org_map['saml_auditor_attr'], [])
|
||||
|
||||
_update_org_from_attr(user, "member_role", attr_values, remove, False)
|
||||
_update_org_from_attr(user, "admin_role", attr_admin_values, False, remove_admins)
|
||||
_update_org_from_attr(user, "auditor_role", attr_auditor_values, False, remove_auditors)
|
||||
|
||||
|
||||
def update_user_teams_by_saml_attr(backend, details, user=None, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user