diff --git a/awx/api/serializers.py b/awx/api/serializers.py index 1b642e63dc..119283d181 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -2999,10 +2999,10 @@ class ActivityStreamSerializer(BaseSerializer): rel = {} if obj.actor is not None: rel['actor'] = reverse('api:user_detail', args=(obj.actor.pk,)) - for fk, __ in SUMMARIZABLE_FK_FIELDS.items(): + for fk, __ in SUMMARIZABLE_FK_FIELDS.items() + [('workflow_job_template', 0)]: if not hasattr(obj, fk): continue - allm2m = getattr(obj, fk).distinct() + allm2m = getattr(obj, fk).all() if getattr(obj, fk).exists(): rel[fk] = [] for thisItem in allm2m: @@ -3017,11 +3017,11 @@ class ActivityStreamSerializer(BaseSerializer): def get_summary_fields(self, obj): summary_fields = OrderedDict() - for fk, related_fields in SUMMARIZABLE_FK_FIELDS.items(): + for fk, related_fields in SUMMARIZABLE_FK_FIELDS.items() + [('workflow_job_template', DEFAULT_SUMMARY_FIELDS)]: try: if not hasattr(obj, fk): continue - allm2m = getattr(obj, fk).distinct() + allm2m = getattr(obj, fk).all() if getattr(obj, fk).exists(): summary_fields[fk] = [] for thisItem in allm2m: diff --git a/awx/main/access.py b/awx/main/access.py index db27608af8..42314bc9b9 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -2105,7 +2105,9 @@ class ActivityStreamAccess(BaseAccess): qs = qs.prefetch_related('organization', 'user', 'inventory', 'host', 'group', 'inventory_source', 'inventory_update', 'credential', 'team', 'project', 'project_update', 'permission', 'job_template', 'job', 'ad_hoc_command', - 'notification_template', 'notification', 'label', 'role', 'actor') + 'notification_template', 'notification', 'label', 'role', 'actor', + 'schedule', 'role', 'custom_inventory_script', 'unified_job_template', + 'workflow_job_template') if self.user.is_superuser or self.user.is_system_auditor: return qs.all() @@ -2118,6 +2120,7 @@ class ActivityStreamAccess(BaseAccess): project_set = Project.accessible_objects(self.user, 'read_role') jt_set = JobTemplate.accessible_objects(self.user, 'read_role') team_set = Team.accessible_objects(self.user, 'read_role') + wfjt_set = WorkflowJobTemplate.accessible_objects(self.user, 'read_role') return qs.filter( Q(ad_hoc_command__inventory__in=inventory_set) | @@ -2135,6 +2138,9 @@ class ActivityStreamAccess(BaseAccess): Q(project_update__project__in=project_set) | Q(job_template__in=jt_set) | Q(job__job_template__in=jt_set) | + Q(workflow_job_template__in=wfjt_set) | + Q(workflow_job_template_node__workflow_job_template__in=wfjt_set) | + Q(workflow_job__workflow_job_template__in=wfjt_set) | Q(notification_template__organization__in=auditing_orgs) | Q(notification__notification_template__organization__in=auditing_orgs) | Q(label__organization__in=auditing_orgs) |