Unable to add new tabs in tabs layout

Created on 21 October 2024, about 2 months ago

Problem/Motivation

As an editor who does not have "bypass content access control" permission:
When I am editing a tabs layout and I click 'Add Tab' nothing happens.

The logs indicate that an access denied response has been returned.

Module versions used

Drupal Core: 10.3
Mercury Layouts: dev-2.0.x
Layout Paragraphs: dev-2.1.x

Investigations performed so far

As far as I can tell, the route mercury_layouts.add_region delegates access control to _layout_paragraphs_builder_access
I tried adding breakpoints to debug the access function in LayoutParagraphsBuilderAccess. I found that the 3rd access check ("Check access to specific paragraph entity") evaluates as AccessResponseNeutral, which then causes the whole function to respond AccessResponseNeutral and hence denies access. Of particular note, the value of $operation that is passed to the access function is NULL.

I suspect that the problem is that Mercury Layouts isn't passing a value through for $operation when it calls LayoutParagraphsBuilderAccess::access.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom andrew robinson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @andrew robinson
  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States justin2pin

    Thanks Andrew! Check out MR!10 and let me know if this addresses the issue for you. This is now just picking up Layout Paragraphs operations, which means the same permissions for Layout Paragraph's "create", "delete," and "reorder" operations will be used and applied to tabs and accordions.

    To use the MR as a patch, you can reference https://git.drupalcode.org/project/mercury_layouts/-/merge_requests/10.patch in your composer.json file.

    If this works for you all, I'll merge!

  • πŸ‡¬πŸ‡§United Kingdom andrew robinson

    Thanks Justin. I've tested the patch and it works.

    However, I'm not sure I understand which permissions are controlling this?
    When I look at the layout_paragraphs module I don't see any permissions defined.

    I've seen that there is a sub-module called layout_paragraphs_permissions, but I don't have this enabled.

Production build 0.71.5 2024