mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 15:58:45 -03:30
Filter out roles users shouldn't be able to see from parents/children lists
This commit is contained in:
@@ -3742,10 +3742,9 @@ class RoleParentsList(SubListAPIView):
|
|||||||
new_in_300 = True
|
new_in_300 = True
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
# XXX: This should be the intersection between the roles of the user
|
|
||||||
# and the roles that the requesting user has access to see
|
|
||||||
role = Role.objects.get(pk=self.kwargs['pk'])
|
role = Role.objects.get(pk=self.kwargs['pk'])
|
||||||
return role.parents.all()
|
return Role.filter_visible_roles(self.request.user, role.parents.all())
|
||||||
|
|
||||||
|
|
||||||
class RoleChildrenList(SubListAPIView):
|
class RoleChildrenList(SubListAPIView):
|
||||||
|
|
||||||
@@ -3757,10 +3756,8 @@ class RoleChildrenList(SubListAPIView):
|
|||||||
new_in_300 = True
|
new_in_300 = True
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
# XXX: This should be the intersection between the roles of the user
|
|
||||||
# and the roles that the requesting user has access to see
|
|
||||||
role = Role.objects.get(pk=self.kwargs['pk'])
|
role = Role.objects.get(pk=self.kwargs['pk'])
|
||||||
return role.children.all()
|
return Role.filter_visible_roles(self.request.user, role.children.all())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user