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
This commit is contained in:
parent
60cf320315
commit
f0736c5174
|
@ -89,10 +89,7 @@ class RoleAssignmentsTab(tabs.TableTab):
|
||||||
slug = "roleassignments"
|
slug = "roleassignments"
|
||||||
template_name = "horizon/common/_detail_table.html"
|
template_name = "horizon/common/_detail_table.html"
|
||||||
preload = False
|
preload = False
|
||||||
|
policy_rules = (("identity", "identity:list_role_assignments"),)
|
||||||
def allowed(self, request):
|
|
||||||
return policy.check((("identity", "identity:list_role_assignments"),),
|
|
||||||
self.request)
|
|
||||||
|
|
||||||
def get_roleassignmentstable_data(self):
|
def get_roleassignmentstable_data(self):
|
||||||
user = self.tab_group.kwargs['user']
|
user = self.tab_group.kwargs['user']
|
||||||
|
@ -139,10 +136,7 @@ class GroupsTab(tabs.TableTab):
|
||||||
slug = "groups"
|
slug = "groups"
|
||||||
template_name = "horizon/common/_detail_table.html"
|
template_name = "horizon/common/_detail_table.html"
|
||||||
preload = False
|
preload = False
|
||||||
|
policy_rules = (("identity", "identity:list_groups"),)
|
||||||
def allowed(self, request):
|
|
||||||
return policy.check((("identity", "identity:list_groups"),),
|
|
||||||
self.request)
|
|
||||||
|
|
||||||
def get_groupstable_data(self):
|
def get_groupstable_data(self):
|
||||||
user_groups = []
|
user_groups = []
|
||||||
|
|
Loading…
Reference in New Issue