mirror of
https://github.com/ansible/awx.git
synced 2026-02-21 13:10:11 -03:30
Ensure hosts list properly when given read access to a smart inventory
This commit is contained in:
@@ -1959,6 +1959,13 @@ class InventoryHostsList(SubListCreateAttachDetachAPIView):
|
||||
parent_key = 'inventory'
|
||||
capabilities_prefetch = ['inventory.admin']
|
||||
|
||||
def get_queryset(self):
|
||||
inventory = self.get_parent_object()
|
||||
if inventory.kind == 'smart':
|
||||
filter_qs = SmartFilter.query_from_string(inventory.host_filter)
|
||||
return filter_qs.distinct()
|
||||
return super(InventoryHostsList, self).get_queryset()
|
||||
|
||||
|
||||
class HostGroupsList(ControlledByScmMixin, SubListCreateAttachDetachAPIView):
|
||||
''' the list of groups a host is directly a member of '''
|
||||
|
||||
Reference in New Issue
Block a user