X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Frest%2Ftests%2Fmodules%2Frest_test%2Frest_test.module;fp=web%2Fcore%2Fmodules%2Frest%2Ftests%2Fmodules%2Frest_test%2Frest_test.module;h=8897fb98116b88bdf7a861785c2e7729c04a5708;hp=7df2863702954037ec027d6823c913a26d74333b;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/modules/rest/tests/modules/rest_test/rest_test.module b/web/core/modules/rest/tests/modules/rest_test/rest_test.module index 7df286370..8897fb981 100644 --- a/web/core/modules/rest/tests/modules/rest_test/rest_test.module +++ b/web/core/modules/rest/tests/modules/rest_test/rest_test.module @@ -14,19 +14,32 @@ use Drupal\Core\Access\AccessResult; * Implements hook_entity_field_access(). * * @see \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::setUp() - * @see \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::testPost() */ function rest_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) { + // @see \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::testPost() + // @see \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::testPatch() if ($field_definition->getName() === 'field_rest_test') { switch ($operation) { case 'view': - // Never ever allow this field to be viewed: this lets EntityResourceTestBase::testGet() test in a "vanilla" way. + // Never ever allow this field to be viewed: this lets + // EntityResourceTestBase::testGet() test in a "vanilla" way. return AccessResult::forbidden(); case 'edit': return AccessResult::forbidden(); } } + // @see \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::testGet() + // @see \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::testPatch() + if ($field_definition->getName() === 'field_rest_test_multivalue') { + switch ($operation) { + case 'view': + // Never ever allow this field to be viewed: this lets + // EntityResourceTestBase::testGet() test in a "vanilla" way. + return AccessResult::forbidden(); + } + } + // No opinion. return AccessResult::neutral(); }