From 831bf9124f6b3a8cb0707d4651141bb5db13caab Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Mon, 30 Mar 2020 15:34:00 -0400 Subject: [PATCH] prevent manual updates at POST /api/v2/inventory_sources/N/update/ see: https://github.com/ansible/awx/issues/6309 --- awx/main/models/inventory.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index d94b428581..3ff6545f25 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -1345,6 +1345,12 @@ class InventorySource(UnifiedJobTemplate, InventorySourceOptions, CustomVirtualE def get_absolute_url(self, request=None): return reverse('api:inventory_source_detail', kwargs={'pk': self.pk}, request=request) + @property + def can_update(self): + if self.source == '': + return False + return super(InventorySource, self).can_update + def _can_update(self): if self.source == 'custom': return bool(self.source_script)