Fix EE admin not being able to PATCH/PUT object while providing organization (#15348)

* Fix bug where EE object-level admin could not set organization

* Finish polishing up test
This commit is contained in:
Alan Rominger
2024-07-09 16:55:09 -04:00
committed by GitHub
parent b727d2c3b3
commit 282ba36839
2 changed files with 20 additions and 6 deletions

View File

@@ -1419,10 +1419,6 @@ class ExecutionEnvironmentAccess(BaseAccess):
else:
if self.user not in obj.organization.execution_environment_admin_role:
raise PermissionDenied
if data and 'organization' in data:
new_org = get_object_from_data('organization', Organization, data, obj=obj)
if not new_org or self.user not in new_org.execution_environment_admin_role:
return False
return self.check_related('organization', Organization, data, obj=obj, role_field='execution_environment_admin_role')
def can_delete(self, obj):