Allow POLICY_CHECK_FUNCTION to be disabled

Remove the current defaulting behaviour when it is set to None.

Change-Id: If8e018414f9f348980d0783f90afa039330e0e49
Closes-Bug: 1634677
This commit is contained in:
Richard Jones 2016-10-19 09:36:28 +11:00
parent 42e37f8dfa
commit 2f2222daf8
2 changed files with 10 additions and 12 deletions

View File

@ -66,7 +66,8 @@ files containing a "default" rule would be ambiguous.
Default: ``policy.check``
This value should not be changed, although removing it would be a means to
bypass all policy checks.
bypass all policy checks. Set it to ``None`` in ``local_settings.py`` to
do this.
How user's roles are determined

View File

@ -297,7 +297,14 @@ THEME_COLLECTION_DIR = 'themes'
# Theme Cookie Name
THEME_COOKIE_NAME = 'theme'
POLICY_CHECK_FUNCTION = None
def check(actions, request, target=None):
# Note(Itxaka): This is to prevent circular dependencies and apps not ready
# If you do django imports in your settings, you are gonna have a bad time
from openstack_auth import policy
return policy.check(actions, request, target)
POLICY_CHECK_FUNCTION = check
CSRF_COOKIE_AGE = None
@ -428,16 +435,6 @@ settings_utils.update_dashboards(
)
INSTALLED_APPS[0:0] = ADD_INSTALLED_APPS
def check(actions, request, target=None):
# Note(Itxaka): This is to prevent circular dependencies and apps not ready
# If you do django imports in your settings, you are gonna have a bad time
from openstack_auth import policy
return policy.check(actions, request, target)
if POLICY_CHECK_FUNCTION is None:
POLICY_CHECK_FUNCTION = check
NG_TEMPLATE_CACHE_AGE = NG_TEMPLATE_CACHE_AGE if not DEBUG else 0
# This base context objects gets added to the offline context generator