diff --git a/core/modules/file/src/FileAccessControlHandler.php b/core/modules/file/src/FileAccessControlHandler.php index 27955a0..e42373e 100644 --- a/core/modules/file/src/FileAccessControlHandler.php +++ b/core/modules/file/src/FileAccessControlHandler.php @@ -82,7 +82,7 @@ protected function checkCreateAccess(AccountInterface $account, array $context, */ protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) { // No user can add the status of a file to avoid to save as persistent. - if ($field_definition->getName() == 'status') { + if ($field_definition->getName() == 'status' && $operation == 'edit') { return AccessResult::forbidden(); } return AccessResult::allowed(); diff --git a/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php b/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php index c63bd94..b30c0a5 100644 --- a/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php +++ b/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php @@ -190,33 +190,6 @@ public function denormalize($data, $class, $format = NULL, array $context = arra } } - // Validate file fields. - /*if ($this->moduleHandler->moduleExists('file')) { - // Get the properties from the current entity to obtain files later. - $properties = $entity->getTypedData()->getProperties(); - - foreach ($entity->getFieldDefinitions() as $property_name => $definition) { - // Check if the current field is a file or image. - if ($definition->getType() == 'image' || $definition->getType() == 'file') { - // Instantiate the field type to obtain validators. - $field = \Drupal::service('plugin.manager.field.field_type') - ->createInstance('file', ['field_definition' => $definition, 'name' => 'field_file', 'parent' => NULL]); - $validators = $field->getUploadValidators(); - - // Get the file from the referenced entities. - if ($files = $properties[$property_name]->referencedEntities()) { - foreach ($files as $file) { - // Validate the file. - if ($errors = file_validate($file, $validators)) { - // @TODO show errors. - throw new UnexpectedValueException('Validation Error!'); - } - } - } - } - } - }*/ - return $entity; }