core/modules/rest/src/Plugin/rest/resource/EntityResource.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php index 1087468..3d3072d 100644 --- a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php +++ b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php @@ -244,10 +244,12 @@ public function patch(EntityInterface $original_entity, EntityInterface $entity // Check access for all received fields, but only if they are being // changed. The bundle of an entity, for example, must be provided for // denormalization to succeed, but it may not be changed. - elseif (!$original_field->equals($field) && !$original_field->access('edit')) { - throw new AccessDeniedHttpException("Access denied on updating field '$field_name'."); + elseif (!$original_field->equals($field)) { + if (!$original_field->access('edit')) { + throw new AccessDeniedHttpException("Access denied on updating field '$field_name'."); + } + $original_entity->set($field_name, $field->getValue()); } - $original_entity->set($field_name, $field->getValue()); } // Validate the received data before saving.