diff --git a/doc/source/topics/policy.rst b/doc/source/topics/policy.rst index 9a9c676251..21a03a1332 100644 --- a/doc/source/topics/policy.rst +++ b/doc/source/topics/policy.rst @@ -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 diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py index 3e2c1a8cc6..800fee0454 100644 --- a/openstack_dashboard/settings.py +++ b/openstack_dashboard/settings.py @@ -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