mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
Add more of the expected details to activity stream related component lists
This commit is contained in:
parent
70fe75603e
commit
447043eae5
@ -366,6 +366,16 @@ class TeamActivityStreamList(SubListAPIView):
|
||||
parent_model = Team
|
||||
relationship = 'activitystream_set'
|
||||
|
||||
def get_queryset(self):
|
||||
parent = self.get_parent_object()
|
||||
self.check_parent_access(parent)
|
||||
qs = self.request.user.get_queryset(self.model)
|
||||
return qs.filter(Q(team=parent) |
|
||||
Q(project__in=parent.projects.all()) |
|
||||
Q(credential__in=parent.credentials.all()) |
|
||||
Q(permission__in=parent.permissions.all()))
|
||||
|
||||
|
||||
class ProjectList(ListCreateAPIView):
|
||||
|
||||
model = Project
|
||||
@ -411,6 +421,13 @@ class ProjectActivityStreamList(SubListAPIView):
|
||||
parent_model = Project
|
||||
relationship = 'activitystream_set'
|
||||
|
||||
def get_queryset(self):
|
||||
parent = self.get_parent_object()
|
||||
self.check_parent_access(parent)
|
||||
qs = self.request.user.get_queryset(self.model)
|
||||
return qs.filter(Q(project=parent) | Q(credential__in=parent.credential))
|
||||
|
||||
|
||||
class ProjectUpdatesList(SubListAPIView):
|
||||
|
||||
model = ProjectUpdate
|
||||
@ -609,6 +626,13 @@ class InventoryActivityStreamList(SubListAPIView):
|
||||
parent_model = Inventory
|
||||
relationship = 'activitystream_set'
|
||||
|
||||
def get_queryset(self):
|
||||
parent = self.get_parent_object()
|
||||
self.check_parent_access(parent)
|
||||
qs = self.request.user.get_queryset(self.model)
|
||||
return qs.filter(Q(inventory=parent) | Q(host__in=parent.hosts.all()) | Q(group__in=parent.groups.all()))
|
||||
|
||||
|
||||
class HostList(ListCreateAPIView):
|
||||
|
||||
model = Host
|
||||
@ -657,6 +681,13 @@ class HostActivityStreamList(SubListAPIView):
|
||||
parent_model = Host
|
||||
relationship = 'activitystream_set'
|
||||
|
||||
def get_queryset(self):
|
||||
parent = self.get_parent_object()
|
||||
self.check_parent_access(parent)
|
||||
qs = self.request.user.get_queryset(self.model)
|
||||
return qs.filter(Q(host=parent) | Q(inventory=parent.inventory))
|
||||
|
||||
|
||||
class GroupList(ListCreateAPIView):
|
||||
|
||||
model = Group
|
||||
@ -742,6 +773,11 @@ class GroupActivityStreamList(SubListAPIView):
|
||||
parent_model = Group
|
||||
relationship = 'activitystream_set'
|
||||
|
||||
def get_queryset(self):
|
||||
parent = self.get_parent_object()
|
||||
self.check_parent_access(parent)
|
||||
qs = self.request.user.get_queryset(self.model)
|
||||
return qs.filter(Q(group=parent) | Q(host__in=parent.hosts.all()))
|
||||
|
||||
class GroupDetail(RetrieveUpdateDestroyAPIView):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user