mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
Test fixup and InventorySource fixup
This commit is contained in:
parent
2e6e7ff9c8
commit
076a91ea6d
@ -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:
|
||||
|
@ -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']]
|
||||
|
Loading…
Reference in New Issue
Block a user