diff --git a/awx/main/access.py b/awx/main/access.py index 91d78fc849..a7dd569bee 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -487,9 +487,11 @@ class InventorySourceAccess(BaseAccess): model = InventorySource def get_queryset(self): - qs = self.model.accessible_by(self.user, {'read':True}) + qs = self.model.objects qs = qs.select_related('created_by', 'modified_by', 'group', 'inventory') - return qs + inventory_ids = set(self.user.get_queryset(Inventory).values_list('id', flat=True)) + return qs.filter(Q(inventory_id__in=inventory_ids) | + Q(group__inventory_id__in=inventory_ids)) def can_read(self, obj): if obj and obj.group: diff --git a/awx/main/tests/old/jobs/jobs_monolithic.py b/awx/main/tests/old/jobs/jobs_monolithic.py index 9286b93084..a42eb2dfaa 100644 --- a/awx/main/tests/old/jobs/jobs_monolithic.py +++ b/awx/main/tests/old/jobs/jobs_monolithic.py @@ -265,7 +265,7 @@ class JobTemplateTest(BaseJobTestMixin, django.test.TransactionTestCase): # Chuck is temporarily assigned to ops east team to help them running some playbooks # even though he's in a different group and org entirely he'll now see their job templates - self.team_ops_east.users.add(self.user_chuck) + self.team_ops_east.deprecated_users.add(self.user_chuck) with self.current_user(self.user_chuck): resp = self.get(url, expect=200) #print [x['name'] for x in resp['results']]