root(minor): allow subapps to define CELERY_BEAT_SCHEDULE
This commit is contained in:
parent
fc69b6851d
commit
0154def916
|
@ -60,7 +60,8 @@ class AuditEntry(UUIDModel):
|
||||||
# User 255.255.255.255 as fallback if IP cannot be determined
|
# User 255.255.255.255 as fallback if IP cannot be determined
|
||||||
request_ip=client_ip or '255.255.255.255',
|
request_ip=client_ip or '255.255.255.255',
|
||||||
context=kwargs)
|
context=kwargs)
|
||||||
LOGGER.debug("Logged %s from %s (%s)", action, user, client_ip)
|
LOGGER.debug("Created Audit entry", action=action,
|
||||||
|
user=user, from_ip=client_ip, context=kwargs)
|
||||||
return entry
|
return entry
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
|
|
@ -30,7 +30,7 @@ def authenticate(request, backends, **credentials) -> Optional[User]:
|
||||||
signature = Signature.from_callable(backend.authenticate)
|
signature = Signature.from_callable(backend.authenticate)
|
||||||
signature.bind(request, **credentials)
|
signature.bind(request, **credentials)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
LOGGER.debug("Backend doesn't accept our arguments", backend=backend)
|
LOGGER.warning("Backend doesn't accept our arguments", backend=backend)
|
||||||
# This backend doesn't accept these credentials as arguments. Try the next one.
|
# This backend doesn't accept these credentials as arguments. Try the next one.
|
||||||
continue
|
continue
|
||||||
LOGGER.debug('Attempting authentication...', backend=backend)
|
LOGGER.debug('Attempting authentication...', backend=backend)
|
||||||
|
|
|
@ -134,7 +134,7 @@ class AuthenticationView(UserPassesTestMixin, View):
|
||||||
LOGGER.debug("Rendering Factor", next_factor=next_factor)
|
LOGGER.debug("Rendering Factor", next_factor=next_factor)
|
||||||
return _redirect_with_qs('passbook_core:auth-process', self.request.GET)
|
return _redirect_with_qs('passbook_core:auth-process', self.request.GET)
|
||||||
# User passed all factors
|
# User passed all factors
|
||||||
LOGGER.debug("User passed all factors, logging in")
|
LOGGER.debug("User passed all factors, logging in", user=self.pending_user)
|
||||||
return self._user_passed()
|
return self._user_passed()
|
||||||
|
|
||||||
def user_invalid(self):
|
def user_invalid(self):
|
||||||
|
|
|
@ -307,7 +307,12 @@ if any('test' in arg for arg in sys.argv):
|
||||||
CELERY_TASK_ALWAYS_EAGER = True
|
CELERY_TASK_ALWAYS_EAGER = True
|
||||||
|
|
||||||
|
|
||||||
_DISALLOWED_ITEMS = ['INSTALLED_APPS', 'MIDDLEWARE', 'AUTHENTICATION_BACKENDS']
|
_DISALLOWED_ITEMS = [
|
||||||
|
'INSTALLED_APPS',
|
||||||
|
'MIDDLEWARE',
|
||||||
|
'AUTHENTICATION_BACKENDS',
|
||||||
|
'CELERY_BEAT_SCHEDULE'
|
||||||
|
]
|
||||||
# Load subapps's INSTALLED_APPS
|
# Load subapps's INSTALLED_APPS
|
||||||
for _app in INSTALLED_APPS:
|
for _app in INSTALLED_APPS:
|
||||||
if _app.startswith('passbook'):
|
if _app.startswith('passbook'):
|
||||||
|
@ -318,6 +323,7 @@ for _app in INSTALLED_APPS:
|
||||||
INSTALLED_APPS.extend(getattr(app_settings, 'INSTALLED_APPS', []))
|
INSTALLED_APPS.extend(getattr(app_settings, 'INSTALLED_APPS', []))
|
||||||
MIDDLEWARE.extend(getattr(app_settings, 'MIDDLEWARE', []))
|
MIDDLEWARE.extend(getattr(app_settings, 'MIDDLEWARE', []))
|
||||||
AUTHENTICATION_BACKENDS.extend(getattr(app_settings, 'AUTHENTICATION_BACKENDS', []))
|
AUTHENTICATION_BACKENDS.extend(getattr(app_settings, 'AUTHENTICATION_BACKENDS', []))
|
||||||
|
CELERY_BEAT_SCHEDULE.update(getattr(app_settings, 'CELERY_BEAT_SCHEDULE', {}))
|
||||||
for _attr in dir(app_settings):
|
for _attr in dir(app_settings):
|
||||||
if not _attr.startswith('__') and _attr not in _DISALLOWED_ITEMS:
|
if not _attr.startswith('__') and _attr not in _DISALLOWED_ITEMS:
|
||||||
globals()[_attr] = getattr(app_settings, _attr)
|
globals()[_attr] = getattr(app_settings, _attr)
|
||||||
|
|
Reference in New Issue