From e1853372f7a939f1759a6ee79676e0b3446fc0c0 Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Mon, 27 Jun 2016 11:41:00 -0400 Subject: [PATCH] Adding comments to signals for rbac activity stream --- awx/main/signals.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/awx/main/signals.py b/awx/main/signals.py index 4d7cbb374b..18f901457c 100644 --- a/awx/main/signals.py +++ b/awx/main/signals.py @@ -168,13 +168,15 @@ def rbac_activity_stream(instance, sender, **kwargs): role = kwargs['model'].objects.filter(pk__in=kwargs['pk_set']).first() # don't record implicit creation / parents if role.content_type is not None: - parent = role.content_type.name + "." + role.role_field - + # Get the list of implicit parents that were defined at the class level. + # We have to take this list from the class property to avoid including parents + # that may have been added since the creation of the ImplicitRoleField implicit_parents = getattr(instance.content_object.__class__, instance.role_field).field.parent_role if type(implicit_parents) != list: implicit_parents = [implicit_parents] - + # Ignore any singleton parents we find. If the parent for the role + # matches any of the implicit parents we find, skip recording the activity stream. for ip in implicit_parents: if '.' not in ip and 'singleton:' not in ip: ip = instance.content_type.name + "." + ip