Hidden HOST in instance overview page for normal user

If the logined user is normal user, the instance overview page
will always show "HOST: -". There is no need show them for normal
users, it may cause some safety problem.

Closes-Bug: 1417849
Change-Id: Ib51bb05822fe910e97f73af56a8d6856764f7653
This commit is contained in:
jing.liuqing 2015-02-04 11:10:23 +08:00 committed by tinytmy
parent 9a0a958bd7
commit 5ae1f3c44f
2 changed files with 6 additions and 3 deletions
openstack_dashboard/dashboards/project/instances
tabs.py
templates/instances

@ -33,7 +33,8 @@ class OverviewTab(tabs.Tab):
"_detail_overview.html")
def get_context_data(self, request):
return {"instance": self.tab_group.kwargs['instance']}
return {"instance": self.tab_group.kwargs['instance'],
"is_superuser": request.user.is_superuser}
class LogTab(tabs.Tab):

@ -19,8 +19,10 @@
<dd>{{ instance.created|parse_isotime }}</dd>
<dt>{% trans "Time Since Created" %}</dt>
<dd>{{ instance.created|parse_isotime|timesince }}</dd>
<dt>{% trans "Host" %}</dt>
<dd>{{ instance.host_server|default:_("-") }}</dd>
{% if is_superuser %}
<dt>{% trans "Host" %}</dt>
<dd>{{ instance.host_server|default:_("-") }}</dd>
{% endif %}
</dl>
</div>