Remove link for user id field on project action log
The action log under project dashboard should not link to the user details panel which requires admin permission. Change-Id: I802188db6f1f8fc7e854980eca85d3b1a75aec1e Closes-bug: #1667154
This commit is contained in:
parent
d4face9967
commit
804db52d7d
@ -13,6 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from django.core import urlresolvers
|
||||||
from django.template.defaultfilters import title # noqa
|
from django.template.defaultfilters import title # noqa
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import ungettext_lazy
|
from django.utils.translation import ungettext_lazy
|
||||||
@ -21,6 +22,7 @@ from horizon import tables
|
|||||||
from horizon.utils import filters
|
from horizon.utils import filters
|
||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
|
from openstack_dashboard.dashboards.project.instances import audit_tables
|
||||||
from openstack_dashboard.dashboards.project.instances \
|
from openstack_dashboard.dashboards.project.instances \
|
||||||
import tables as project_tables
|
import tables as project_tables
|
||||||
from openstack_dashboard import policy
|
from openstack_dashboard import policy
|
||||||
@ -187,3 +189,17 @@ class AdminInstancesTable(tables.DataTable):
|
|||||||
project_tables.SoftRebootInstance,
|
project_tables.SoftRebootInstance,
|
||||||
project_tables.RebootInstance,
|
project_tables.RebootInstance,
|
||||||
project_tables.DeleteInstance)
|
project_tables.DeleteInstance)
|
||||||
|
|
||||||
|
|
||||||
|
def user_link(datum):
|
||||||
|
return urlresolvers.reverse("horizon:identity:users:detail",
|
||||||
|
args=(datum.user_id,))
|
||||||
|
|
||||||
|
|
||||||
|
class AdminAuditTable(audit_tables.AuditTable):
|
||||||
|
user_id = tables.Column('user_id', verbose_name=_('User ID'),
|
||||||
|
link=user_link)
|
||||||
|
|
||||||
|
class Meta(object):
|
||||||
|
name = 'audit'
|
||||||
|
verbose_name = _('Instance Action List')
|
||||||
|
30
openstack_dashboard/dashboards/admin/instances/tabs.py
Normal file
30
openstack_dashboard/dashboards/admin/instances/tabs.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Copyright 2017 OpenStack Foundation
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from horizon import tabs
|
||||||
|
|
||||||
|
from openstack_dashboard.dashboards.admin.instances import tables
|
||||||
|
from openstack_dashboard.dashboards.project.instances import tabs \
|
||||||
|
as project_tabs
|
||||||
|
|
||||||
|
|
||||||
|
class AuditTab(project_tabs.AuditTab):
|
||||||
|
table_classes = (tables.AdminAuditTable,)
|
||||||
|
|
||||||
|
|
||||||
|
class AdminInstanceDetailTabs(tabs.DetailTabsGroup):
|
||||||
|
slug = "instance_details"
|
||||||
|
tabs = (project_tabs.OverviewTab, project_tabs.LogTab,
|
||||||
|
project_tabs.ConsoleTab, AuditTab)
|
||||||
|
sticky = True
|
@ -35,6 +35,7 @@ from openstack_dashboard.dashboards.admin.instances \
|
|||||||
import forms as project_forms
|
import forms as project_forms
|
||||||
from openstack_dashboard.dashboards.admin.instances \
|
from openstack_dashboard.dashboards.admin.instances \
|
||||||
import tables as project_tables
|
import tables as project_tables
|
||||||
|
from openstack_dashboard.dashboards.admin.instances import tabs
|
||||||
from openstack_dashboard.dashboards.project.instances import views
|
from openstack_dashboard.dashboards.project.instances import views
|
||||||
from openstack_dashboard.dashboards.project.instances.workflows \
|
from openstack_dashboard.dashboards.project.instances.workflows \
|
||||||
import update_instance
|
import update_instance
|
||||||
@ -218,6 +219,7 @@ class LiveMigrateView(forms.ModalFormView):
|
|||||||
|
|
||||||
|
|
||||||
class DetailView(views.DetailView):
|
class DetailView(views.DetailView):
|
||||||
|
tab_group_class = tabs.AdminInstanceDetailTabs
|
||||||
redirect_url = 'horizon:admin:instances:index'
|
redirect_url = 'horizon:admin:instances:index'
|
||||||
image_url = 'horizon:admin:images:detail'
|
image_url = 'horizon:admin:images:detail'
|
||||||
volume_url = 'horizon:admin:volumes:detail'
|
volume_url = 'horizon:admin:volumes:detail'
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
from django.core import urlresolvers
|
|
||||||
from django.utils.translation import pgettext_lazy
|
from django.utils.translation import pgettext_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
@ -21,11 +20,6 @@ from horizon import tables
|
|||||||
from horizon.utils import filters
|
from horizon.utils import filters
|
||||||
|
|
||||||
|
|
||||||
def user_link(datum):
|
|
||||||
return urlresolvers.reverse("horizon:identity:users:detail",
|
|
||||||
args=(datum.user_id,))
|
|
||||||
|
|
||||||
|
|
||||||
class AuditTable(tables.DataTable):
|
class AuditTable(tables.DataTable):
|
||||||
ACTION_DISPLAY_CHOICES = (
|
ACTION_DISPLAY_CHOICES = (
|
||||||
("create", pgettext_lazy("Action log of an instance", u"Create")),
|
("create", pgettext_lazy("Action log of an instance", u"Create")),
|
||||||
@ -48,8 +42,7 @@ class AuditTable(tables.DataTable):
|
|||||||
display_choices=ACTION_DISPLAY_CHOICES)
|
display_choices=ACTION_DISPLAY_CHOICES)
|
||||||
start_time = tables.Column('start_time', verbose_name=_('Start Time'),
|
start_time = tables.Column('start_time', verbose_name=_('Start Time'),
|
||||||
filters=[filters.parse_isotime])
|
filters=[filters.parse_isotime])
|
||||||
user_id = tables.Column('user_id', verbose_name=_('User ID'),
|
user_id = tables.Column('user_id', verbose_name=_('User ID'))
|
||||||
link=user_link)
|
|
||||||
message = tables.Column('message', verbose_name=_('Message'))
|
message = tables.Column('message', verbose_name=_('Message'))
|
||||||
|
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
|
Loading…
Reference in New Issue
Block a user