mirror of
https://github.com/ansible/awx.git
synced 2026-01-24 16:01:20 -03:30
add code to HostAccess can_add so the browsable API will work
This commit is contained in:
parent
a078254508
commit
5dbbaf4105
@ -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')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user