mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 10:30:03 -03:30
Make sure that validation of managed EEs makes sense
- missing fields in a patch request should be ignored - compare the organization pks, if present
This commit is contained in:
parent
9992bf03b0
commit
d5deedc822
@ -710,8 +710,12 @@ class ExecutionEnvironmentDetail(RetrieveUpdateDestroyAPIView):
|
||||
fields_to_check = ['name', 'description', 'organization', 'image', 'credential']
|
||||
if instance.managed and request.user.can_access(models.ExecutionEnvironment, 'change', instance):
|
||||
for field in fields_to_check:
|
||||
if kwargs.get('partial') and field not in request.data:
|
||||
continue
|
||||
left = getattr(instance, field, None)
|
||||
right = request.data.get(field, None)
|
||||
if hasattr(left, 'id'):
|
||||
left = left.id
|
||||
right = request.data.get(field)
|
||||
if left != right:
|
||||
raise PermissionDenied(_("Only the 'pull' field can be edited for managed execution environments."))
|
||||
return super().update(request, *args, **kwargs)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user