- First commit to issue fork.
- π§πͺBelgium Jonasanne
Uploaded the diff of the MR for ease of use as a patch
When we use translations and modules which use hook_node_access_records we can't add/edit paragraphs on adding translation form for node by some roles. It affects to roles, which doesn't have permission "edit any/own %content_type% content", but have allowable record in node_access table.
Let's imagine we have created news in English language. So we have allowable record in node_access table for english version. And now we are adding French translation.
In this case we have next access to logic for paragraph widget on adding translation form:
1. Check access on paragraph.
2. \Drupal\paragraphs\ParagraphAccessControlHandler::checkAccess fallbacks to access for parent entity.
3. Check access on parent entity.
4. \Drupal\Core\Entity\EntityAccessControlHandler::access invokes entity_access and node_access hooks, which result AccessResultNeutral result.
5. Because we have neutral access \Drupal\node\NodeAccessControlHandler::checkAccess invokes grantStorage access.
6. \Drupal\node\NodeGrantDatabaseStorage::access check records for French node, which in fact not saved yet.
So on the one hand we have allowable permission in node_access table for English language, but on the other hand we have prepared and filled entity with french fields, but in fact not saved yet. So we have message "You are not allowed to edit or remove this Paragraph", but we must have required access.
It have investigated this issue and I can propose solution to provide identical solution as we have on creating new node. While we create new node, method \Drupal\paragraphs\Entity\Paragraph::getParentEntity returns NULL. So I offer to modify this method for returning NULL if we have no saved trasnlation for entity.
I will apply patch in comments.
Needs review
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Uploaded the diff of the MR for ease of use as a patch