backend of org-scoped smart inventories

This commit is contained in:
AlanCoding
2017-08-29 16:43:56 -04:00
parent a3b29a196c
commit ff96a750e1
5 changed files with 45 additions and 3 deletions

View File

@@ -37,6 +37,8 @@ class HostManager(models.Manager):
hasattr(self.instance, 'kind')):
if self.instance.kind == 'smart' and self.instance.host_filter is not None:
q = SmartFilter.query_from_string(self.instance.host_filter)
if self.instance.organization_id:
q = q.filter(inventory__organization=self.instance.organization_id)
# If we are using host_filters, disable the core_filters, this allows
# us to access all of the available Host entries, not just the ones associated
# with a specific FK/relation.