This issue is a follow-up of issue "Error multilingual node" to target the issue more precisely.
People cannot use PbT with the content translation module. Because they get errors. PbT sets 1 language per node. There should be no language set by PbT. Drupal's node access records are able to handle this automatically.
Workaround
Do not enable the content translation module, but enable the
modules. Then you can specify a language for your nodes, by preserving a separate node id for each node. If you do not need separate permissions for each language, then this issue is not affecting you at all.
Comments
Comment #2
jepster_Comment #3
jepster_Comment #4
amairesse commentedI am facing the access denied issue related in https://www.drupal.org/node/2866284.
I do not need separate permissions for each language but the website is translated in a "normal fashion", meaning using the Content Translation module - common node ID for all languages. We could not maintain this large translated website without Content Translation module enabled.
Is there any way PbT can work in this configuration ?
Comment #5
rwam commentedSame problem here like @amairesse.
I think the problem is situated in missing entries in table node_access. I've made some tests and this are my results:
1. add a node and a translation (no tag)
database entries (table
node_access– columnsnid langcode fallback gid realm grant_view grant_update grant_delete):result: each translation is visible for all users
2. edit a node and add a restriced tag (»Only access by authenticated users«)
database entries:
result: english works as expected, but german is only accessible for administrator.
3. update database by duplicate row with changed language key
database entries:
result: each translation is visible for authenticated users – it works
4. update of the node leads delete the translated row ;-(
database entries and result: see 2.
Summary:
The missing entry for the translation in node_access leads to the error.
I would change priority to »Major« because the module is not usable for multilingual sites at the moment.
Comment #6
jepster_You are just repeating, what is already written in the description of this issue. The content translation module is not supported at the moment. Take a look on the workaround.
What's needed to support the content translation module, is already described in the issue description.
Feel free to create a patch and post it here to add the missing feature for your use-case. You can also create a pull request via the PbT Git repository at GitHub. It is your use-case. I do not need this feature personally. This would be a really good contribution from your end.
Comment #7
jepster_Comment #8
jepster_I have updated PbT's project description to avoid confusion.
If you can't provide a patch: please contact me via the contact form on my user profile, if you would like to provide funding to get this feature done.
PbT is an open-source software project. You are already saving a lot of time and money by using the current PbT version. It would just be fair, if you would provide support for implementation of this feature for your purpose.
Comment #9
jepster_Comment #10
rwam commentedThe description of hook_node_access_records() mentioned the following:
So I've created the attached patch which solved the problem for me. After applying the patch you have to rebuild the permissions by running database updates with running
update.phpordrush updbor using of/admin/reports/status/rebuild.Comment #12
jepster_Comment #13
jepster_Comment #14
jepster_Thanks! Looks good to me. I have patched PbT and released your fix with version 8.x-1.42: https://www.drupal.org/project/permissions_by_term/releases/8.x-1.42. I have modified the update hook a bit, to match the current release version.
Closing this issue. Please feel free to re-open it, if you have any objections.
Comment #15
jepster_Comment #16
amairesse commented@rwam : Tested, this works fine.
Many thanks!
Comment #17
jepster_Glad to read. :)
Comment #18
genat commentedThank you rwam! #10 worked like a charm!!!
Comment #19
jepster_Please notice: this fix is part of the current stable PbT release.
Comment #20
jepster_