summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-01-13 16:43:52 +0000
committerGerrit Code Review <review@openstack.org>2019-01-13 16:43:53 +0000
commita1ffa9620e42b83ff0a0b7ffee8c3215ebd69afd (patch)
tree2f49722adfe2a75218fa0ab1ad20046d7b866e66
parentbe5b04ca6d62e23086daaca5873e5d18bf4f43f4 (diff)
parentc6baf007341aab17035bb5e77a6ab8143b069cd4 (diff)
Merge "Allow to hide openrc and clouds.yaml download links"
-rw-r--r--doc/source/configuration/settings.rst19
-rw-r--r--openstack_dashboard/dashboards/project/api_access/tables.py6
-rw-r--r--openstack_dashboard/local/local_settings.py.example8
-rw-r--r--openstack_dashboard/settings.py15
-rw-r--r--releasenotes/notes/openrc-clouds-yaml-link-f1642b77e25f08ba.yaml10
5 files changed, 51 insertions, 7 deletions
diff --git a/doc/source/configuration/settings.rst b/doc/source/configuration/settings.rst
index da2d4b2..c5888fa 100644
--- a/doc/source/configuration/settings.rst
+++ b/doc/source/configuration/settings.rst
@@ -835,6 +835,25 @@ MEMOIZED_MAX_SIZE_DEFAULT allows setting a global default to help control
835memory usage when caching. It should at least be 2 x the number of threads 835memory usage when caching. It should at least be 2 x the number of threads
836with a little bit of extra buffer. 836with a little bit of extra buffer.
837 837
838SHOW_OPENRC_FILE
839----------------
840
841.. versionadded:: 15.0.0(Stein)
842
843Default:: ``True``
844
845Controls whether the keystone openrc file is accesible from the user
846menu and the api access panel.
847
848SHOW_OPENSTACK_CLOUDS_YAML
849--------------------------
850
851.. versionadded:: 15.0.0(Stein)
852
853Default:: ``True``
854
855Controls whether clouds.yaml is accesible from the user
856menu and the api access panel.
838 857
839SHOW_KEYSTONE_V2_RC 858SHOW_KEYSTONE_V2_RC
840-------------------- 859--------------------
diff --git a/openstack_dashboard/dashboards/project/api_access/tables.py b/openstack_dashboard/dashboards/project/api_access/tables.py
index 9788047..9f4bc40 100644
--- a/openstack_dashboard/dashboards/project/api_access/tables.py
+++ b/openstack_dashboard/dashboards/project/api_access/tables.py
@@ -51,6 +51,9 @@ class DownloadCloudsYaml(tables.LinkAction):
51 icon = "download" 51 icon = "download"
52 url = "horizon:project:api_access:clouds.yaml" 52 url = "horizon:project:api_access:clouds.yaml"
53 53
54 def allowed(self, request, datum=None):
55 return settings.SHOW_OPENSTACK_CLOUDS_YAML
56
54 57
55class DownloadOpenRC(tables.LinkAction): 58class DownloadOpenRC(tables.LinkAction):
56 name = "download_openrc" 59 name = "download_openrc"
@@ -68,7 +71,8 @@ class DownloadOpenRC(tables.LinkAction):
68 self.verbose_name = _("OpenStack RC File (Identity API v3)") 71 self.verbose_name = _("OpenStack RC File (Identity API v3)")
69 72
70 def allowed(self, request, datum=None): 73 def allowed(self, request, datum=None):
71 return utils.get_keystone_version() >= 3 74 return (settings.SHOW_OPENRC_FILE and
75 utils.get_keystone_version() >= 3)
72 76
73 77
74class DownloadOpenRCv2(tables.LinkAction): 78class DownloadOpenRCv2(tables.LinkAction):
diff --git a/openstack_dashboard/local/local_settings.py.example b/openstack_dashboard/local/local_settings.py.example
index 2ad4078..a599bd3 100644
--- a/openstack_dashboard/local/local_settings.py.example
+++ b/openstack_dashboard/local/local_settings.py.example
@@ -114,6 +114,14 @@ WEBROOT = '/'
114# and the API Access page 114# and the API Access page
115#SHOW_KEYSTONE_V2_RC = False 115#SHOW_KEYSTONE_V2_RC = False
116 116
117# Controls whether the keystone openrc file is accesible from the user
118# menu and the api access panel.
119SHOW_OPENRC_FILE = True
120
121# Controls whether clouds.yaml is accesible from the user
122# menu and the api access panel.
123SHOW_OPENSTACK_CLOUDS_YAML = True
124
117# If provided, a "Report Bug" link will be displayed in the site header 125# If provided, a "Report Bug" link will be displayed in the site header
118# which links to the value of this setting (ideally a URL containing 126# which links to the value of this setting (ideally a URL containing
119# information on how to report issues). 127# information on how to report issues).
diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py
index fb5c700..e0bfd92 100644
--- a/openstack_dashboard/settings.py
+++ b/openstack_dashboard/settings.py
@@ -348,6 +348,8 @@ CSRF_COOKIE_AGE = None
348COMPRESS_OFFLINE_CONTEXT = 'horizon.themes.offline_context' 348COMPRESS_OFFLINE_CONTEXT = 'horizon.themes.offline_context'
349 349
350SHOW_KEYSTONE_V2_RC = False 350SHOW_KEYSTONE_V2_RC = False
351SHOW_OPENRC_FILE = True
352SHOW_OPENSTACK_CLOUDS_YAML = True
351 353
352# Dictionary of currently available angular features 354# Dictionary of currently available angular features
353ANGULAR_FEATURES = { 355ANGULAR_FEATURES = {
@@ -429,12 +431,13 @@ if USER_MENU_LINKS is None:
429 'icon_classes': ['fa-download', ], 431 'icon_classes': ['fa-download', ],
430 'url': 'horizon:project:api_access:openrcv2', 432 'url': 'horizon:project:api_access:openrcv2',
431 }) 433 })
432 USER_MENU_LINKS.append({ 434 if SHOW_OPENRC_FILE:
433 'name': (_('OpenStack RC File v3') if SHOW_KEYSTONE_V2_RC 435 USER_MENU_LINKS.append({
434 else _('OpenStack RC File')), 436 'name': (_('OpenStack RC File v3') if SHOW_KEYSTONE_V2_RC
435 'icon_classes': ['fa-download', ], 437 else _('OpenStack RC File')),
436 'url': 'horizon:project:api_access:openrc', 438 'icon_classes': ['fa-download', ],
437 }) 439 'url': 'horizon:project:api_access:openrc',
440 })
438 441
439if not WEBROOT.endswith('/'): 442if not WEBROOT.endswith('/'):
440 WEBROOT += '/' 443 WEBROOT += '/'
diff --git a/releasenotes/notes/openrc-clouds-yaml-link-f1642b77e25f08ba.yaml b/releasenotes/notes/openrc-clouds-yaml-link-f1642b77e25f08ba.yaml
new file mode 100644
index 0000000..bd03223
--- /dev/null
+++ b/releasenotes/notes/openrc-clouds-yaml-link-f1642b77e25f08ba.yaml
@@ -0,0 +1,10 @@
1---
2features:
3 - |
4 [:bug:`1795851`] Operators now can control whether the links of
5 "Download OpenRC" and "Download clouds.yaml" are displayed or not
6 via new settings ``SHOW_OPENRC_FILE`` and ``SHOW_OPENSTACK_CLOUDS_YAML``.
7 ``openrc`` and ``clouds.yaml`` files provided by horizon now assume
8 the basic simple deployment and do not cover keystone authentication
9 like saml2, openid and so on. The default ``openrc`` and ``clouds.yaml``
10 from horizon do not make sense for such environments.