13256 cleanup settings logic

This commit is contained in:
Arthur 2023-08-10 17:17:43 +07:00
parent e55d3c860e
commit 4b0db7ed05
2 changed files with 17 additions and 19 deletions

View File

@ -60,7 +60,7 @@ class TokenAuthentication(authentication.TokenAuthentication):
user = token.user
# When LDAP authentication is active try to load user data from LDAP directory
if 'netbox.authentication.LDAPBackend' in settings.REMOTE_AUTH_BACKEND:
if settings.REMOTE_AUTH_ENABLED and 'netbox.authentication.LDAPBackend' in settings.REMOTE_AUTH_BACKEND:
from netbox.authentication import LDAPBackend
ldap_backend = LDAPBackend()

View File

@ -123,8 +123,6 @@ QUEUE_MAPPINGS = getattr(configuration, 'QUEUE_MAPPINGS', {})
RELEASE_CHECK_URL = getattr(configuration, 'RELEASE_CHECK_URL', None)
REMOTE_AUTH_ENABLED = getattr(configuration, 'REMOTE_AUTH_ENABLED', False)
if REMOTE_AUTH_ENABLED:
# ignore setting if REMOTE_AUTH_ENABLED not set
REMOTE_AUTH_AUTO_CREATE_USER = getattr(configuration, 'REMOTE_AUTH_AUTO_CREATE_USER', False)
REMOTE_AUTH_AUTO_CREATE_GROUPS = getattr(configuration, 'REMOTE_AUTH_AUTO_CREATE_GROUPS', False)
REMOTE_AUTH_BACKEND = getattr(configuration, 'REMOTE_AUTH_BACKEND', 'netbox.authentication.RemoteUserBackend')