- 🇺🇸United States j.cowher
Re-rolled the patch from #4 to apply to version 3.1.33.
- Status changed to Needs review
10 months ago 6:06pm 19 April 2024
We have a multilingual site with English being the default language. We have both content types and taxonomy terms translated. When creating content users can select the language used to create the content. Basically they are selecting between English and Finnish.
Permissions by Terms works fine when they create English content and term permissions are set to the English terms.
But there seems to be a mix up in languages when user creates a content in Finnish and attaches a term to it because the term default language is English.
When the method canUserAccessByNodeId() is called its getting the current language and the term default language and comparing those together:
if ($termInfo instanceof Term && $termInfo->get('langcode')->getLangcode() == $langcode) {
At least in our setup in the edit page, the current interface language returns fi but the term default language is usually returning en. This prevents the module from going to the code block which is checking for term permissions and always gives access denied to the user.
Ideally we could check if there is a translation for the term in the current language and use that in code. If the translation is not found we could fallback to the default language and see if there are matching permissions for that. But this is problematic if there is a situation where the taxonomy term translations would have different permissions attached.
Needs review
3.1
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Re-rolled the patch from #4 to apply to version 3.1.33.