Skip to content
Snippets Groups Projects
Verified Commit 257191b8 authored by Dave Long's avatar Dave Long
Browse files

Issue #3395431 by acbramley, smustgrave, larowlan: BlockContent JSON:API...

Issue #3395431 by acbramley, smustgrave, larowlan: BlockContent JSON:API collection endpoint doesn't return unpublished block when filtered without administer block content permission
parent 1bdb6ed2
No related branches found
No related tags found
No related merge requests found
......@@ -183,6 +183,7 @@ function jsonapi_jsonapi_block_content_filter_access(EntityTypeInterface $entity
// \Drupal\jsonapi\Access\TemporaryQueryGuard adds the condition for
// (isReusable()), so this does not have to.
return ([
JSONAPI_FILTER_AMONG_ALL => AccessResult::allowedIfHasPermission($account, 'access block library'),
JSONAPI_FILTER_AMONG_PUBLISHED => AccessResult::allowed(),
]);
}
......
......@@ -68,6 +68,11 @@ class BlockContentTest extends ResourceTestBase {
protected function setUpAuthorization($method) {
switch ($method) {
case 'GET':
$this->grantPermissionsToTestedRole([
'access block library',
]);
break;
case 'PATCH':
$this->grantPermissionsToTestedRole([
'access block library',
......@@ -86,6 +91,14 @@ protected function setUpAuthorization($method) {
}
}
/**
* {@inheritdoc}
*/
protected function setUpRevisionAuthorization($method) {
parent::setUpRevisionAuthorization($method);
$this->grantPermissionsToTestedRole(['view any basic block content history']);
}
/**
* {@inheritdoc}
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment