Hi,
I've been trying to get this module to work on D9 with the patch from #3114359. It didn't install cleanly but I've manually patched the info.yml to add the version requirements.
When I rebuild permissions, then set permissions for anon to view all basic pages there is no access to any nodes at all. Are there default permissions that should be set that the ones provided by this module override or should they work independently of anything else going on.
I've previously had content_access installed but uninstalled it properly so I don't think that's a problem although possibly worth mentioning.
Many thanks in advance,
Comment | File | Size | Author |
---|---|---|---|
#12 | node_view_permissions_language_und.patch | 661 bytes | cafuego |
Comments
Comment #2
adityasingh CreditAttribution: adityasingh as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedComment #3
Yazzbe CreditAttribution: Yazzbe as a volunteer and commentedupgraded form drupal 8.8 to 8.9 + upgraded Node View Permissions to 1.3
rebuild permissions ... and I have also no page access for anonymous users.
reverting back to 1.2 + restoring a database backup fixed it on D8.9.6
Comment #4
brunodboI ran into a similar issue today after updating to v8.1.3 of Node View Permissions, and rebuilding node access permissions: some content became inaccessible to authenticated users who had access to the content previously. Downgrading to v8.1.2 + rebuilding node access permissions fixed it.
Using core 8.9.6.
Comment #5
medienverbinder CreditAttribution: medienverbinder as a volunteer commentedI could see the same error when updating to Drupal 8.9.6 and Node View Permissions to 1.3.
On all public pages (anonymous users) I got the error message "Access denied"
The logfile showed the following:
type: access denied
Path: /. Drupal\Core\Http\Exception\CacheableAccessDeniedHttpException: in Drupal\Core\Routing\AccessAwareRouter->checkAccess() (line 117 of /core/lib/Drupal/Core/Routing/AccessAwareRouter.php).
The solution from #3 or #4 helped.
Comment #6
jcourtice CreditAttribution: jcourtice as a volunteer and at VMLY&R for VMLY&R commentedWe had a similar issue arise. Group users couldn't view their content via the admin screen. Rolling back to 1.2 solved the issue.
Comment #7
SoCalErich CreditAttribution: SoCalErich commented+1 for this issue. On Drupal 8.9.6. Had to revert back to Node View Permissions 1.2 and all was well.
Comment #8
AardWolf CreditAttribution: AardWolf at ADCI Solutions commentedHi all.
Do you clear the cache?
Is your site multilanguage?
Do you use Workflow module?
Because there's only 2 changes:
1. Add implementation for Workflows and Content Moderation #3011136: Add implementation for Workflows and Content Moderation
2. D9 compatibility #3141235: Automated Drupal Rector fixes
Could you write step by step manual to reproduce issue?
We need to know which permissions is set for content type. It will be helpful.
Comment #9
Yazzbe CreditAttribution: Yazzbe as a volunteer and commentedtested on drupal 8.9.7 + node view permissions 1.3 with the same result.
error happens after 'rebuilding permissions' on the status page => no acces for anonymous users any more
Comment #10
SoCalErich CreditAttribution: SoCalErich commentedI currently have 13 languages on my site and am also using content moderation with the Workflow module. I clear the cache and rebuild permissions and clear cache again etc. What's weird is I cant really figure out why it only affects some pages. It's not ALL pages. I dont know what the rhyme or reason is to it, but I definitely start getting Access Denied for some pages. If I revert the module, everything is fine again.
Comment #11
AardWolf CreditAttribution: AardWolf at ADCI Solutions commentedBut what's about permissions on content in Nodes and Node view permissions?
Comment #12
cafuego CreditAttribution: cafuego at United Nations commentedI've got what I expect is the same issue on one of our websites, which started happening after a node content access rebuild after updating this module from v1.2 to v1.3. Some users, anonymous and authenticated, lost access to some content they were previously able to see.
I traced the access grants queries that Drupal runs, and found what I think is the problem. Drupal generates a node_access query for a given node type with the grant strings view_any_{$type}_content plus view_any_{$type}_{$langcode}_content (for all enabled languages) when determining access.
The node_view_permissions does write those grants records when content has a langcode *or* Language::LANGCODE_NOT_APPLICABLE (zxx) but where it falls over is when the langcode is Language::LANGCODE_NOT_SPECIFIED (und).
In that case, the access query looks for any grants with view_any_{$type}_content but the grants that were written to the node_access table use realm view_any_${type}_und_content, so the query returns an empty result and access is rejected.
You can hotfix that by running this query (after doing a database backup, just in case!)
UPDATE node_access SET realm=REPLACE(realm, '_und_content', '_content') WHERE realm LIKE '%\_und\_content';
And then rebuilding caches. If you then rebuild the access perms, access will disappear again, so don't :-)
A more permanent fix is to write the correct node grants to begin with for any content with Language::LANGCODE_NOT_SPECIFIED. The attached patch does that by treating it the same as other language neutral or untranslated content. It would probably be a good idea to add some tests, to stop this breaking in the future.
Comment #13
cafuego CreditAttribution: cafuego at United Nations commentedComment #15
adci_contributor CreditAttribution: adci_contributor at ADCI Solutions commented@cafuego
Thank you for investigating issue reason and for patch.