1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

change inventory can_change to require admin role

This commit is contained in:
AlanCoding 2016-06-15 08:17:00 -04:00
parent 716ae49947
commit 81c3ae4470

View File

@ -354,15 +354,7 @@ class InventoryAccess(BaseAccess):
@check_superuser
def can_change(self, obj, data):
# Verify that the user has access to the new organization if moving an
# inventory to a new organization.
org_pk = get_pk_from_dict(data, 'organization')
if obj and org_pk and obj.organization.pk != org_pk:
org = get_object_or_400(Organization, pk=org_pk)
if self.user not in org.admin_role:
return False
# Otherwise, just check for write permission.
return self.user in obj.update_role
return self.can_admin(obj, data)
@check_superuser
def can_admin(self, obj, data):