diff --git a/doc/source/configuration/settings.rst b/doc/source/configuration/settings.rst index 814bee020b..bb19af10ed 100644 --- a/doc/source/configuration/settings.rst +++ b/doc/source/configuration/settings.rst @@ -865,6 +865,16 @@ This SESSION_TIMEOUT is a method to supercede the token timeout with a shorter horizon session timeout (in seconds). So if your token expires in 60 minutes, a value of 1800 will log users out after 30 minutes. +SHOW_KEYSTONE_V2_RC +-------------------- + +.. versionadded:: 13.0.0(Queens) + +Default: ``True`` + +Controls whether the keystone v2 openrc file is accessable from the user +menu and the api access panel. + THEME_COLLECTION_DIR -------------------- diff --git a/openstack_dashboard/context_processors.py b/openstack_dashboard/context_processors.py index 0a490a0428..1aa74e30ea 100644 --- a/openstack_dashboard/context_processors.py +++ b/openstack_dashboard/context_processors.py @@ -97,6 +97,7 @@ def openstack(request): hmac_keys, parent_id=index_view_id) context['JS_CATALOG'] = get_js_catalog(conf) + context['SHOW_KEYSTONE_V2_RC'] = settings.SHOW_KEYSTONE_V2_RC return context diff --git a/openstack_dashboard/dashboards/project/api_access/tables.py b/openstack_dashboard/dashboards/project/api_access/tables.py index cddddc14e6..17e274f6ab 100644 --- a/openstack_dashboard/dashboards/project/api_access/tables.py +++ b/openstack_dashboard/dashboards/project/api_access/tables.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +from django.conf import settings from django.template.defaultfilters import title from django.utils.translation import ugettext_lazy as _ @@ -70,6 +71,9 @@ class DownloadOpenRCv2(tables.LinkAction): icon = "download" url = "horizon:project:api_access:openrcv2" + def allowed(self, request, datum=None): + return settings.SHOW_KEYSTONE_V2_RC + class ViewCredentials(tables.LinkAction): name = "view_credentials" diff --git a/openstack_dashboard/local/local_settings.py.example b/openstack_dashboard/local/local_settings.py.example index 77a022912c..177b76e83d 100644 --- a/openstack_dashboard/local/local_settings.py.example +++ b/openstack_dashboard/local/local_settings.py.example @@ -108,6 +108,11 @@ WEBROOT = '/' # or None. Set to None explicitly if you want to deactivate the console. #CONSOLE_TYPE = "AUTO" +# Toggle showing the openrc file for Keystone V2. +# If set to false the link will be removed from the user dropdown menu +# and the API Access page +#SHOW_KEYSTONE_V2_RC = True + # If provided, a "Report Bug" link will be displayed in the site header # which links to the value of this setting (ideally a URL containing # information on how to report issues). diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py index e4f4d3718a..1999362598 100644 --- a/openstack_dashboard/settings.py +++ b/openstack_dashboard/settings.py @@ -322,6 +322,8 @@ CSRF_COOKIE_AGE = None COMPRESS_OFFLINE_CONTEXT = 'horizon.themes.offline_context' +SHOW_KEYSTONE_V2_RC = True + # Dictionary of currently available angular features ANGULAR_FEATURES = { 'images_panel': True, diff --git a/openstack_dashboard/templates/header/_user_menu.html b/openstack_dashboard/templates/header/_user_menu.html index 1f7d7f41d2..4601f21017 100644 --- a/openstack_dashboard/templates/header/_user_menu.html +++ b/openstack_dashboard/templates/header/_user_menu.html @@ -34,12 +34,14 @@ {% endif %} -
  • - - - {% trans "OpenStack RC File v2" %} - -
  • + {% if SHOW_KEYSTONE_V2_RC %} +
  • + + + {% trans "OpenStack RC File v2" %} + +
  • + {% endif %}
  • @@ -66,4 +68,3 @@ {% else %}
  • {% endif %} -