doTestCollectionFilterAccessForPublishableEntities example


  protected function doTestRelationshipMutation(array $request_options) {
    $this->grantPermissionsToTestedRole(['access content']);
    parent::doTestRelationshipMutation($request_options);
  }

  /** * {@inheritdoc} */
  public function testCollectionFilterAccess() {
    $this->doTestCollectionFilterAccessForPublishableEntities('name', 'view media', 'administer media');
  }

}
return [
      'type' => ['administer comment types'],
      'uid' => ['access user profiles'],
    ];
  }

  /** * {@inheritdoc} */
  public function testCollectionFilterAccess() {
    // Verify the expected behavior in the common case.     $this->doTestCollectionFilterAccessForPublishableEntities('subject', 'access comments', 'administer comments');

    $collection_url = Url::fromRoute('jsonapi.entity_test--bar.collection');
    $request_options = [];
    $request_options[RequestOptions::HEADERS]['Accept'] = 'application/vnd.api+json';
    $request_options = NestedArray::mergeDeep($request_options$this->getAuthenticationRequestOptions());

    // Go back to a simpler scenario: revoke the admin permission, publish the     // comment and uninstall the query access test module.     $this->revokePermissionsFromTestedRole(['administer comments']);
    $this->entity->setPublished()->save();
    $this->assertTrue($this->container->get('module_installer')->uninstall(['jsonapi_test_field_filter_access'], TRUE), 'Uninstalled modules.');
    

      'jsonapi' => static::$jsonApiMember,
    ];
    $this->assertResourceResponse(404, $expected_document$response);
  }

  /** * {@inheritdoc} */
  public function testCollectionFilterAccess() {
    $label_field_name = 'title';
    $this->doTestCollectionFilterAccessForPublishableEntities($label_field_name, 'access content', 'bypass node access');

    $collection_url = Url::fromRoute('jsonapi.entity_test--bar.collection');
    $collection_filter_url = $collection_url->setOption('query', ["filter[spotlight.$label_field_name]" => $this->entity->label()]);
    $request_options = [];
    $request_options[RequestOptions::HEADERS]['Accept'] = 'application/vnd.api+json';
    $request_options = NestedArray::mergeDeep($request_options$this->getAuthenticationRequestOptions());

    $this->revokePermissionsFromTestedRole(['bypass node access']);

    // 0 results because the node is unpublished.     $response = $this->request('GET', $collection_filter_url$request_options);
    
if ($sparse_fieldset === NULL || in_array('body', $sparse_fieldset)) {
      $contexts = Cache::mergeContexts($contexts['languages:language_interface', 'theme']);
    }
    return $contexts;
  }

  /** * {@inheritdoc} */
  public function testCollectionFilterAccess() {
    $this->entity->setPublished()->save();
    $this->doTestCollectionFilterAccessForPublishableEntities('info', NULL, 'administer block content');
  }

}
Home | Imprint | This part of the site doesn't use cookies.