/usr/lib/python2.7/dist-packages/guardian/checks.py is in python-django-guardian 1.4.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | from django.core.checks import register, Tags, Warning
from django.conf import settings
# noinspection PyUnusedLocal
@register(Tags.compatibility)
def check_settings(app_configs, **kwargs):
""" Check that settings are implemented properly
:param app_configs: a list of apps to be checks or None for all
:param kwargs: keyword arguments
:return: a list of errors
"""
checks = []
if 'guardian.backends.ObjectPermissionBackend' not in settings.AUTHENTICATION_BACKENDS:
msg = ("Guardian authentication backend is not hooked. You can add this in settings as eg: "
"`AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', "
"'guardian.backends.ObjectPermissionBackend')`.")
checks.append(Warning(msg, id='guardian.W001'))
if not settings.ANONYMOUS_USER_ID:
msg = ("No anonymous user ID is defined. Guardian supports anonymous user object permissions, therefore "
"this needs to be specified in settings: `ANONYMOUS_USER_ID = -1`.")
checks.append(Warning(msg, id='guardian.W002'))
return checks
|