MenuLinkContentAccessControlHandler does not allow "view" access without admin permission, making these entities inaccessible via REST, JSON API and GraphQL and entity reference fields

Created on 12 October 2017, over 6 years ago
Updated 29 April 2024, about 1 month ago

Menu link 'view' permission is set to 'Administer Menu' which does not allow for exposing menu links via the jsonapi module (e.g. /jsonapi/menu_link_content/menu_link_content). Should permission instead be granted to access those links based on ability to access the linked resources?

πŸ“Œ Task
Status

Needs work

Version

11.0 πŸ”₯

Component
Menu link contentΒ  β†’

Last updated 13 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States cachesclay

Live updates comments and jobs are added and updated live.
  • Contributed project blocker

    It denotes an issue that prevents porting of a contributed project to the stable version of Drupal due to missing APIs, regressions, and so on.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work about 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom marekgti

    Modified #82 patch to allow unrouted links that starts with "/"

  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    Closed πŸ› Custom menu item entity reference is not accessible to anonymous user Closed: duplicate as a duplicate of this. Discussed with @catch in #bugsmash and the possible problems with entity references should probably be handled here too.

  • πŸ‡¨πŸ‡¦Canada Austin986

    Patch #85 not working on Drupal 10.0.9.
    It says patch can not be applied.
    Any idea?

  • πŸ‡¨πŸ‡¦Canada Austin986

    Patch #85's compatible version for Drupal 10.1.x.

  • πŸ‡¨πŸ‡¦Canada Austin986

    Patch #88 still not working if paragraph is a part of extra field of meu item.
    Because it tries to check permission to access entity.menu_link_content.canonical, and it seems there is no way to set custom permission for entity.menu_link_content.canonical, without any additional module installed.

    This patch simply ignores all access permission for "view" case, to make sure all menu items are visible.

    PLEASE DO NOT USE THIS PATCH, if you need menu item specific permission set up.

  • last update about 1 year ago
    29,378 pass
  • last update about 1 year ago
    Custom Commands Failed
  • πŸ‡§πŸ‡ͺBelgium tim-diels Belgium πŸ‡§πŸ‡ͺ

    @Lendude regarding "Discussed with @catch in #bugsmash and the possible problems with entity references should probably be handled here too." ... Could you give some more info on what needs to be done to get this issue moving again?

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @Lendude & @Voleger, we just came to this issue from here: #2925283: New fields visibility and access β†’

    TL;DR: Due to this, entity reference (revision) contents are not visible for guests within the Menu (example: Mega Menu implementation using Paragraphs). Workaround: Use paragraphs_type_permissions submodule, which seems to override this using hook_ENTITY_TYPE_permission()

    Still we'd like to help fixing this in core, so we can remove the workaround.

    You have both invested a lot of time here and I think you're aware of what has to be done to finish this. What ca we do?
    We can reroll the MR against 11.x and 10.3.x but then we should try to finish it and hot have it around for years again... any feedback?

    The MR still seems good, a clear improvement and has a lot of positive feedback.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Here's the current state of the MR339 which still works fine against 10.2.x, 10.3.x and eventually 11.x (haven't tried). Great work @voleger!

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1080s
    #151787
  • πŸ‡ΊπŸ‡¦Ukraine voleger Ukraine, Rivne

    rest and json_api integration tests are failing

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Test are failing because the new link to user/1 is missing in the menu tests. So that should be a very easy fix.

    See this link for all tests that are failing.

  • πŸ‡©πŸ‡ͺGermany Grevil

    Not as simple as it seems. The expected cache tags are invalid, since we are swapping the "https://nl.wikipedia.org/wiki/Llama" link with a cacheable internal link to user:1 out. We can implement a dirty workaround and manually prepend the new cache to "getExpectedCacheTags()", but then the test will just throw an error later on.

    To be honest, the current test changes generally seem really rushed. Simply replacing a remote link string with an internal link inside already existing tests / test bases without changing anything else just doesn't feel right. It also looks like we removed testing for external links entirely?

    I'd say we revert the current test changes and create dedicated tests for internal menu links (json and rest) additionally to the already existing external link tests. Only problem being, that the test structure seems quite complex, so this will probably need quite a bit of work...

    Really unsure about this. Does anybody else have an idea? Maybe there is a super simple way to test this, and we only need to add a quick test without changing any existing tests / test bases?

  • Pipeline finished with Failed
    about 1 month ago
    Total: 1016s
    #159564
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 61s
    #159596
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 149s
    #159601
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 252s
    #159602
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 966s
    #159610
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1420s
    #159627
  • πŸ‡©πŸ‡ͺGermany Grevil

    I reverted the test changes and created a new test class inside the jsonapi space. Unsure, whether to create a REST test class as well. But I don't think we should adjust the rest test base, how we did it in "MenuLinkContentResourceTestBase.php" originally, which I reverted here: https://git.drupalcode.org/project/drupal/-/merge_requests/339/diffs?com....

    Unfortunately, now the old "MenuLinkContentTest" fails. Here, it expects a 403 status code, but it actually receives an unexpected 200 status code. This might show, that the current MR needs some refactoring? I am not sure. These tests are highly complex with many dependencies.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 3348s
    #159694
Production build 0.69.0 2024