From 5dbbaf4105b9fe52526ba590d086710930fa7808 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Fri, 29 Jul 2016 12:02:40 -0400 Subject: [PATCH] add code to HostAccess can_add so the browsable API will work --- awx/main/access.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/main/access.py b/awx/main/access.py index fe1dfb7bbc..7d4dbd1c8d 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -427,8 +427,8 @@ class HostAccess(BaseAccess): return obj and self.user in obj.inventory.read_role def can_add(self, data): - if not data or 'inventory' not in data: - return False + if not data: # So the browseable API will work + return Inventory.accessible_objects(self.user, 'admin_role').exists() # Checks for admin or change permission on inventory. inventory_pk = get_pk_from_dict(data, 'inventory')