You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.8 KiB
70 lines
1.8 KiB
import ldap
|
|
|
|
from django_auth_ldap.config import (
|
|
LDAPSearch, LDAPSearchUnion, {{ mayan_ldap_group_type }}
|
|
)
|
|
|
|
from mayan.settings.production import *
|
|
|
|
ldap.set_option(ldap.OPT_DEBUG_LEVEL, {{ mayan_ldap_debug | ternary('1','0') }})
|
|
|
|
AUTH_LDAP_ALWAYS_UPDATE_USER = True
|
|
LDAP_USER_AUTO_CREATION = True
|
|
|
|
AUTH_LDAP_START_TLS = {{ mayan_ldap_start_tls | ternary('True','False') }}
|
|
|
|
{% if mayan_ldap_bind_dn is defined and mayan_ldap_bind_pass is defined %}
|
|
AUTH_LDAP_BIND_DN = '{{ mayan_ldap_bind_dn }}'
|
|
AUTH_LDAP_BIND_PASSWORD = '{{ mayan_ldap_bind_pass }}'
|
|
{% endif %}
|
|
LDAP_BASE_DN = '{{ mayan_ldap_base }}'
|
|
AUTH_LDAP_SERVER_URI = '{{ mayan_ldap_uri }}'
|
|
|
|
{% if mayan_ldap_user_ou | length > 0 %}
|
|
AUTH_LDAP_USER_SEARCH = LDAPSearchUnion(
|
|
{% for ou in mayan_ldap_user_ou %}
|
|
LDAPSearch(
|
|
'{{ ou }}', ldap.SCOPE_SUBTREE,
|
|
'{{ mayan_ldap_user_filter }}'
|
|
),
|
|
{% endfor %}
|
|
)
|
|
{% else %}
|
|
AUTH_LDAP_USER_SEARCH = LDAPSearch(
|
|
'{{ mayan_ldap_base }}', ldap.SCOPE_SUBTREE,
|
|
'{{ mayan_ldap_user_filter }}'
|
|
)
|
|
{% endif %}
|
|
|
|
AUTH_LDAP_USER_ATTR_MAP = {
|
|
{% for attr in mayan_ldap_user_attr_map.keys() %}
|
|
'{{ attr }}': '{{ mayan_ldap_user_attr_map[attr] }}',
|
|
{% endfor %}
|
|
}
|
|
|
|
{% if mayan_ldap_group_ou | length > 0 %}
|
|
AUTH_LDAP_GROUP_SEARCH = LDAPSearchUnion(
|
|
{% for ou in mayan_ldap_group_ou %}
|
|
LDAPSearch(
|
|
'{{ ou }}', ldap.SCOPE_SUBTREE,
|
|
'{{ mayan_ldap_group_filter }}'
|
|
),
|
|
{% endfor %}
|
|
)
|
|
{% else %}
|
|
AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
|
|
'{{ mayan_ldap_base }}', ldap.SCOPE_SUBTREE,
|
|
'{{ mayan_ldap_group_filter }}'
|
|
)
|
|
{% endif %}
|
|
|
|
AUTH_LDAP_GROUP_TYPE = {{ mayan_ldap_group_type }}()
|
|
|
|
AUTHENTICATION_BACKENDS = (
|
|
'django_auth_ldap.backend.LDAPBackend',
|
|
'django.contrib.auth.backends.ModelBackend'
|
|
)
|
|
|
|
{% if mayan_auth_custom_conf is defined %}
|
|
{{ mayan_auth_custom_conf }}
|
|
{% endif %}
|
|
|