I installed the Entity Print on my site. It works perfectly when used from the administrator user, but it doesn't work with anonymous users.
It gives the following error.
Access denied on the url /entityprint/pdf/node/nid
I tracked the error and found that is was caused by this code.
// Check if the user is allowed to view all bundles of the entity type.
$access_result = AccessResult::allowedIfHasPermission($account, 'entity print access type ' . $entity_type);
if ($access_result->isAllowed()) {
return $access_result->andIf($entity->access('view', $account, TRUE));
}
// Check if the user is allowed to view that bundle type.
$access_result = AccessResult::allowedIfHasPermission($account, 'entity print access bundle ' . $entity->bundle());
if ($access_result->isAllowed()) {
return $access_result->andIf($entity->access('view', $account, TRUE));
}
return AccessResult::forbidden();
The anonymous user doesn't have the permission to view this content type.
I went to the permissions list page and found for each content type the following permissions, but not the permission to view a specific content type.
- View revisions
- Create
- Delete
I have the Domain Access Entity and the Domain Access modules installed.
How can I make return $access_result->andIf($entity->access('view', $account, TRUE));
return true
?