Set CREATE_USER_FUNC and API_PERMISSIONS when using LDAP

This commit is contained in:
PapaTutuWawa 2020-11-08 12:41:38 +01:00
parent b0f888f236
commit e09d5f1723

View File

@ -139,6 +139,10 @@ STATIC_ROOT = os.environ.get('DJANGO_STATIC_ROOT', os.path.join(BASE_DIR, 'stati
MEDIA_ROOT = os.environ.get('DJANGO_MEDIA_ROOT', os.path.join(BASE_DIR, 'media'))
MEDIA_URL = '/user-media/'
ETEBASE_API_PERMISSIONS = ['rest_framework.permissions.IsAuthenticated']
ETEBASE_API_AUTHENTICATORS = ('django_etebase.token_auth.authentication.TokenAuthentication',
'rest_framework.authentication.SessionAuthentication')
ETEBASE_CREATE_USER_FUNC = 'django_etebase.utils.create_user_blocked'
# Define where to find configuration files
config_locations = ['etebase-server.ini', '/etc/etebase-server/etebase-server.ini']
@ -172,10 +176,9 @@ if any(os.path.isfile(x) for x in config_locations):
LDAP_BIND_DN = ldap.get('bind_dn', '')
LDAP_BIND_PW = ldap.get('bind_pw', '')
ETEBASE_API_PERMISSIONS = ('rest_framework.permissions.IsAuthenticated', )
ETEBASE_API_AUTHENTICATORS = ('django_etebase.token_auth.authentication.TokenAuthentication',
'rest_framework.authentication.SessionAuthentication')
ETEBASE_CREATE_USER_FUNC = 'django_etebase.utils.create_user_blocked'
# Configure EteBase to use LDAP
ETEBASE_CREATE_USER_FUNC = 'myauth.ldap.create_user'
ETEBASE_API_PERMISSIONS.append('myauth.ldap.LDAPUserExists')
# Make an `etebase_server_settings` module available to override settings.
try: