Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(NetBox) Allow custom LDAP attributes #18

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions ansible/roles/netbox/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,24 @@ netbox__ldap_object_owner_rdn: 'uid={{ lookup("env", "USER") }}'
netbox__ldap_object_ownerdn: '{{ ([ netbox__ldap_object_owner_rdn, netbox__ldap_people_rdn ]
+ netbox__ldap_base_dn) | join(",") }}'
# ]]]
# ]]]
# .. envvar:: netbox__ldap_attr_firstname [[[
#
# The attribute of the LDAP object that shows the users first name.
netbox__ldap_attr_firstname: 'cn'

# ]]]
# .. envvar:: netbox__ldap_attr_sn [[[
#
# The attribute of the LDAP object that shows the users last name.
netbox__ldap_attr_sn: 'sn'

# ]]]
# .. envvar:: netbox__ldap_attr_mail [[[
#
# The attribute of the LDAP object that shows the users email address.
netbox__ldap_attr_mail: 'mailAddress'

# ]]]
# LDAP connection options [[[
# ---------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ AUTH_LDAP_CACHE_TIMEOUT = int(environ.get('AUTH_LDAP_CACHE_TIMEOUT', 3600))

# Populate the Django user from the LDAP directory.
AUTH_LDAP_USER_ATTR_MAP = {
"first_name": environ.get('AUTH_LDAP_ATTR_FIRSTNAME', 'givenName'),
"last_name": environ.get('AUTH_LDAP_ATTR_LASTNAME', 'sn'),
"email": environ.get('AUTH_LDAP_ATTR_MAIL', 'mailAddress')
"first_name": environ.get('AUTH_LDAP_ATTR_FIRSTNAME', '{{ netbox__ldap_attr_firstname }}'),
"last_name": environ.get('AUTH_LDAP_ATTR_LASTNAME', '{{ netbox__ldap_attr_sn }}'),
"email": environ.get('AUTH_LDAP_ATTR_MAIL', '{{ netbox__ldap_attr_mail }}')
}
Loading