Refactor LDAP_USER_DN to .env

This commit is contained in:
PCoder 2019-02-04 19:56:11 +01:00
parent 7131ed6d5b
commit b0a09969ec
2 changed files with 3 additions and 1 deletions

View file

@ -226,6 +226,8 @@ LDAP_DEFAULT_START_UID = config(
'LDAP_DEFAULT_START_UID', cast=int, default=10000 'LDAP_DEFAULT_START_UID', cast=int, default=10000
) )
LDAP_USER_DN = config('LDAP_USER_DN', default='ou=users,dc=ungleich,dc=ch')
if config('ENABLE_DEBUG_LOG', cast=bool, default=False): if config('ENABLE_DEBUG_LOG', cast=bool, default=False):
loggers_dict = {} loggers_dict = {}
MODULES_TO_LOG = config('MODULES_TO_LOG', 'django') MODULES_TO_LOG = config('MODULES_TO_LOG', 'django')

View file

@ -37,7 +37,7 @@ def create_user(user, password, firstname, lastname, email):
logger.debug("{uid} does not exist. Using it".format(uid=uidNumber)) logger.debug("{uid} does not exist. Using it".format(uid=uidNumber))
set_max_uid(uidNumber) set_max_uid(uidNumber)
w = Writer(conn, obj_new_user) w = Writer(conn, obj_new_user)
dn = 'uid=%s,ou=users,dc=ungleich,dc=ch' % user dn = 'uid=%s,%s' % (user, settings.LDAP_USER_DN)
w.new(dn) w.new(dn)
w[0].givenName = firstname w[0].givenName = firstname
w[0].sn = lastname w[0].sn = lastname