Putting back the inadvertantly removed job_events

This commit is contained in:
Matthew Jones
2017-01-26 12:00:13 -05:00
parent 37d8e57c4f
commit 6388e9b055
2 changed files with 17 additions and 0 deletions

View File

@@ -3473,6 +3473,22 @@ class GroupJobEventsList(BaseJobEventsList):
parent_model = Group
class JobJobEventsList(BaseJobEventsList):
parent_model = Job
def get_queryset(self):
job = self.get_parent_object()
self.check_parent_access(job)
qs = job.job_events.all()
qs = qs.select_related('host')
qs = qs.prefetch_related('hosts', 'children')
if self.request.user.is_superuser or self.request.user.is_system_auditor:
return qs.all()
host_qs = self.request.user.get_queryset(Host)
return qs.filter(Q(host__isnull=True) | Q(host__in=host_qs))
class AdHocCommandList(ListCreateAPIView):
model = AdHocCommand