1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

only special case team when sender is Role_parents

This commit is contained in:
Wayne Witzel III 2016-06-10 17:24:18 -04:00
parent 00698b82fc
commit db16478830

View File

@ -158,14 +158,13 @@ def org_admin_edit_members(instance, action, model, reverse, pk_set, **kwargs):
def rbac_activity_stream(instance, sender, **kwargs):
user_type = ContentType.objects.get_for_model(User)
team_type = ContentType.objects.get_for_model(Team)
# Only if we are associating/disassociating
if kwargs['action'] in ['pre_add', 'pre_remove']:
# Only if this isn't for the User.admin_role
if hasattr(instance, 'content_type'):
if instance.content_type in [None, user_type]:
return
elif instance.content_type == team_type:
elif sender.__name__ == 'Role_parents':
role = kwargs['model'].objects.filter(pk__in=kwargs['pk_set']).first()
else:
role = instance