diff options
author | Mark Goddard <mark@stackhpc.com> | 2021-03-26 13:47:59 +0000 |
---|---|---|
committer | Akihiro Motoki <amotoki@gmail.com> | 2021-04-08 10:59:06 +0900 |
commit | 03a6e1f7e506dd367342206da401b7b4e88d67ba (patch) | |
tree | c800c8339424c523ee52d4fd08a5d24a953e5917 | |
parent | 33c5f63e22d95ca26e74a0ae2a56c40787e92015 (diff) | |
download | horizon-03a6e1f7e506dd367342206da401b7b4e88d67ba.tar.gz |
Use policy_rules for user role assignment and group tabs
The policy_rules feature was added recently, which simplifies making
tabs allowed conditionally based on policy. Use the feature for the User
role assignments and groups tabs.
This is a separate commit to allow the original patch to be backported.
Related-Bug: #1920214
Change-Id: Ic4a16b27c4f2da0daa2ec066d129926c349d1e4b
(cherry picked from commit f0736c5174f18476bf5d0a9df6a65c554ee7c65e)
-rw-r--r-- | openstack_dashboard/dashboards/identity/users/tabs.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/openstack_dashboard/dashboards/identity/users/tabs.py b/openstack_dashboard/dashboards/identity/users/tabs.py index fe8fa3ba6..55986ed19 100644 --- a/openstack_dashboard/dashboards/identity/users/tabs.py +++ b/openstack_dashboard/dashboards/identity/users/tabs.py @@ -89,10 +89,7 @@ class RoleAssignmentsTab(tabs.TableTab): slug = "roleassignments" template_name = "horizon/common/_detail_table.html" preload = False - - def allowed(self, request): - return policy.check((("identity", "identity:list_role_assignments"),), - self.request) + policy_rules = (("identity", "identity:list_role_assignments"),) def get_roleassignmentstable_data(self): user = self.tab_group.kwargs['user'] @@ -139,10 +136,7 @@ class GroupsTab(tabs.TableTab): slug = "groups" template_name = "horizon/common/_detail_table.html" preload = False - - def allowed(self, request): - return policy.check((("identity", "identity:list_groups"),), - self.request) + policy_rules = (("identity", "identity:list_groups"),) def get_groupstable_data(self): user_groups = [] |