- π¦πΉAustria jjchinquist Vienna, Austria
Patch 3084934-13_combine_3090200-22.patch reviewed and it is working. RTBC
Update #43 change andIf to orIf
$access_result = $access_result->orIf($parent_access);
The last submitted patch, 45: 3084934-13_combine_3090200-22-update.patch, failed testing. View results β
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- Status changed to Needs work
almost 2 years ago 7:07am 31 January 2023 - πΊπΈUnited States bkosborne New Jersey, USA
That's not right. It should be set back to
andIf
. Access to view a paragraph requires you have access to view both the paragraph entity AND the parent. Hiding those patches to avoid confusion. - πΊπΈUnited States bkosborne New Jersey, USA
I don't think this current patch is workable. As of the changes introduced in #17, it's just bypassing the parent entity access check entirely if the parent is a block or another paragraph. That seems wrong.
- πΊπΈUnited States bkosborne New Jersey, USA
Marked π Paragraph access check via parent entity incorrectly uses the default revision of the parent instead of the latest Closed: duplicate as a duplicate of this. It's trying to solve the same problem, which essentially is that when a paragraph performs the access check on its parent, it's using the parent's default (AKA "active") revision, when it should be using the revision that that specific paragraph is attached to. I don't think this can be resolved properly until π Store information about a paragraph's parent revision Active is resolved. Once it is, then this issue becomes really simple to solve.
That said, I think loading the parent's correct revision is most important when performing access control for the "view" operation of the paragraph. But for "edit" and "delete", loading the parent's latest revision is appropriate. I think we can solve for that now without waiting on π Store information about a paragraph's parent revision Active
- πΊπΈUnited States luke.leber Pennsylvania
I wasn't able to reproduce this against 9.5.x, but perhaps I'm doing something wrong?
Because of this, paragraphs will not be viewable or editable unless the user has access to view/edit the default revision of the parent entity.
Is it a precondition that the user:
- Has access to view forward revisions
- Does not have access to view default revisions
for an entity type?
- πΊπΈUnited States luke.leber Pennsylvania
I finally have another set of steps to reproduce some wonky behavior here:
- Add a node type with layout overrides enabled.
- Add a block type with a paragraph on it.
- Create a node instance and add a block instance to it, saved as Published.
- Edit the node, add a paragraph item, save it as Draft.
- Edit the node and observe that the paragraph items are unable to be edited or removed with the message "You are not allowed to edit or remove this item."
These are the steps that I'll follow for acceptance testing once we have a patch that doesn't bypass any pre-existing access checks.
- πΊπΈUnited States bkosborne New Jersey, USA
Luke, indeed, I believe the root cause is responsible for both the issue where the paragraph cannot be viewed or edited. The issue with editing was documented in π Paragraph access check via parent entity incorrectly uses the default revision of the parent instead of the latest Closed: duplicate which I closed as a duplicate of this one.
Curious that in your reproduction steps, the paragraphs is still viewable on the published version of the page?
- πΊπΈUnited States luke.leber Pennsylvania
Yeah, they are still visible on the front end for me.
Wouldn't storing the paragraphs' parent revision be sort of impossible for historical data?
- πΊπΈUnited States bkosborne New Jersey, USA
I don't think this current patch is workable. As of the changes introduced in #17, it's just bypassing the parent entity access check entirely if the parent is a block or another paragraph. That seems wrong.
I think I should explain further why this is bad. Imagine you had a private file field on the paragraph which is on the block. Private file fields defer their access control to the entity they're attached to. In this case, it would be the paragraph. This patch, as is, would allow everyone to access the private file.
- last update
over 1 year ago 159 pass, 12 fail - πΊπΈUnited States chrissnyder Maryland
Patch in #22 works well for the specific issue I was encountering, which is explained in the opening post.
- last update
about 1 year ago 178 pass, 2 fail - last update
about 1 year ago 176 pass, 6 fail - last update
about 1 year ago 176 pass, 6 fail - last update
about 1 year ago 178 pass, 2 fail - last update
about 1 year ago 178 pass, 2 fail - π·π΄Romania amateescu
Here's an alternative solution for this problem. The idea is to rely on core's Typed Data system for retrieving the host entity of a paragraph, it's based on the patch proposed in this Drupal core issue: π Allow the 'entity' property of entity reference fields to be aware of its position in the typed data tree Needs review , and it also needs the Entity Reference Revisions patch from π Allow the 'entity' property of entity reference revision fields to be aware of its position in the typed data tree Postponed .
- Status changed to Needs review
10 months ago 10:56am 16 March 2024 - π·π΄Romania amateescu
Posted a new patch in the ERR issue ( #3428639-3: Allow the 'entity' property of entity reference revision fields to be aware of its position in the typed data tree β ), which is simpler and doesn't have to wait for the core issue. So all we need to solve the Layout Builder -> Custom block -> Paragraph problems is the Entity Reference Revisions patch and the one above for Paragraphs.
- πΊπΈUnited States smethawee
Hi @amateescu
The alternative patch #60 solution for this problem is not working for me. Do we still need waiting for review? Thanks! - πΊπΈUnited States smethawee
@amateescu Thank you so much for you connected.
Yes, here what I did below anything that I have to add?Regards,
"drupal/entity_reference_revisions": {
"#3428639-7": " https://www.drupal.org/files/issues/2024-03-16/3428639-7.patch β "
},
"drupal/content_moderation": {
"content-moderation-events-79": " https://www.drupal.org/files/issues/2023-10-11/2873287-content-moderatio... β "
} - πΊπΈUnited States realgt
i tried patch #60 and the Entity Reference Revisions patch mentioned in #61, and it does render my paragraphs in layout_builder edit mode but they are still locked and uneditable. previously the paragraphs would not even render while editing a layout
- πΊπΈUnited States smethawee
Hi @amateescu and @realgt patch #43 is not working for me too. So wondering about this fix. Thanks!
- π¨π¦Canada phjou Vancouver π¨π¦ πͺπΊ
Patch #43 worked for me, it allowed to unblock the situation on both editing, and display on the frontend.
- π¨π¦Canada gordonio
Patch #43 worked for me. Layout builder shows the correct entities in a non published state, and the published version displays the correct revisions.
- First commit to issue fork.
- πͺπΈSpain joe_carvajal Seville (Spain)
Can confirm patch #43 worked for me too with Drupal 10.3.1 and Paragraphs 1.18.