rename A2_AUTH_KERBEROS_ENABLED to _ENABLE (#13099)
This commit is contained in:
parent
198d782e49
commit
a23d4a8591
|
@ -1,10 +1,10 @@
|
|||
class AppSettings(object):
|
||||
__DEFAULTS = {
|
||||
'ENABLED': True,
|
||||
'CREATE_USER': True,
|
||||
'REALM': None,
|
||||
'LDAP_BACKEND': True,
|
||||
'DJANGO_BACKEND': False,
|
||||
'ENABLE': True,
|
||||
'CREATE_USER': True,
|
||||
'REALM': None,
|
||||
'LDAP_BACKEND': True,
|
||||
'DJANGO_BACKEND': False,
|
||||
}
|
||||
|
||||
def __init__(self, prefix):
|
||||
|
@ -12,7 +12,11 @@ class AppSettings(object):
|
|||
|
||||
def _setting(self, name, dflt):
|
||||
from django.conf import settings
|
||||
return getattr(settings, self.prefix+name, dflt)
|
||||
return getattr(settings, self.prefix + name, dflt)
|
||||
|
||||
@property
|
||||
def ENABLE(self):
|
||||
return self._setting('ENABLE', self._setting('ENABLED', self.__DEFAULTS['ENABLE']))
|
||||
|
||||
def __getattr__(self, name):
|
||||
if name not in self.__DEFAULTS:
|
||||
|
|
|
@ -5,7 +5,7 @@ from . import app_settings, utils
|
|||
|
||||
class KerberosFrontend(object):
|
||||
def enabled(self):
|
||||
return app_settings.ENABLED
|
||||
return app_settings.ENABLE
|
||||
|
||||
def name(self):
|
||||
return gettext_noop('Kerberos')
|
||||
|
|
|
@ -32,7 +32,7 @@ class A2KerberosBackend(KerberosBackend):
|
|||
pass
|
||||
|
||||
def authenticate(self, principal=None, **kwargs):
|
||||
if not app_settings.ENABLED:
|
||||
if not app_settings.ENABLE:
|
||||
return
|
||||
if not app_settings.DJANGO_BACKEND:
|
||||
return
|
||||
|
@ -51,7 +51,7 @@ class A2LdapKerberosBackend(LDAPBackend):
|
|||
def authenticate(self, principal=None, **kwargs):
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if not app_settings.ENABLED:
|
||||
if not app_settings.ENABLE:
|
||||
return
|
||||
if not app_settings.LDAP_BACKEND:
|
||||
return
|
||||
|
|
|
@ -8,7 +8,7 @@ def plugin_enabled(view):
|
|||
'''If plugin is not enabled, return 404'''
|
||||
@functools.wraps(view)
|
||||
def wrapper(*args, **kwargs):
|
||||
if not app_settings.ENABLED:
|
||||
if not app_settings.ENABLE:
|
||||
raise Http404
|
||||
return view(*args, **kwargs)
|
||||
return wrapper
|
||||
|
|
Loading…
Reference in New Issue