summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-04-23 23:46:23 +0000
committerGerrit Code Review <review@openstack.org>2016-04-23 23:46:23 +0000
commit68c0fd068dd46d54bedf7daf95903dcba5aaf24a (patch)
tree11885e7cbfb3e514e069c26389420662556bcbdb
parent5e0798bacbb5b68a0286e11e52a8fcc63810cc95 (diff)
parent4857902df661cc86fe58e4879556fa48ce105ad1 (diff)
downloadhorizon-68c0fd068dd46d54bedf7daf95903dcba5aaf24a.tar.gz
Merge "Add policy check for project detail link" into stable/liberty
-rw-r--r--openstack_dashboard/dashboards/identity/projects/tables.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/openstack_dashboard/dashboards/identity/projects/tables.py b/openstack_dashboard/dashboards/identity/projects/tables.py
index 029c0709c..6ccc249df 100644
--- a/openstack_dashboard/dashboards/identity/projects/tables.py
+++ b/openstack_dashboard/dashboards/identity/projects/tables.py
@@ -238,6 +238,23 @@ class TenantsTable(tables.DataTable):
required=False),
update_action=UpdateCell)
+ def get_project_detail_link(self, project):
+ # this method is an ugly monkey patch, needed because
+ # the column link method does not provide access to the request
+ if policy.check((("identity", "identity:get_project"),),
+ self.request, target={"project": project}):
+ return reverse("horizon:identity:projects:detail",
+ args=(project.id,))
+ return None
+
+ def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs):
+ super(TenantsTable,
+ self).__init__(request, data=data,
+ needs_form_wrapper=needs_form_wrapper,
+ **kwargs)
+ # see the comment above about ugly monkey patches
+ self.columns['name'].get_link_url = self.get_project_detail_link
+
class Meta(object):
name = "tenants"
verbose_name = _("Projects")