change of user role has no effect on menu items access without a cache purge

Created on 21 March 2022, about 3 years ago
Updated 2 August 2024, 9 months ago

Problem/Motivation

Installed module and added 'anonymous' access only to a link.
Cleared cache, went to visit the page where the menu appears as administrator, and still see the link there.
Checked the documentation and can confirm the link in question is a menu_link_content entity.

I then went and loaded up simplytest.me with this module installed and created a piece of test content.
Added a link entry to the User Account Menu that points to this piece of test content with 'Anonymous' selected, still visible as admin.
Changed role to 'Content Editor' - still visible as admin.
Also still visible as anonymous, seems to not be doing anything.

Steps to reproduce

1. loaded up simplytest.me with this module installed and created a piece of test content
2. Add a link entry to the User Account Menu that points to this piece of test content with 'Anonymous' selected
3. Check if it's visible logged in
4. Change role control to 'Content Editor' and test again
5. Check if it is visible logged out

Proposed resolution

From the quick tests I did it seems like this module is not operating correctly, at least not with the steps I took.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom ChrisDarke London

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

Comments & Activities

Not all content is available!

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

  • 🇨🇦Canada Snowflake6

    Can confirm that this behaviour continues in Drupal 10. Changing role permissions on menu item does not seem to affect access. Tested by making a menu accessible to all roles but Anonymous, and then logging out. Logged out user can still see and access the menu.

  • 🇩🇪Germany Daniel Kulbe Berlin

    The issue is, you will see the role access checkboxes, event the check is never performed for any menu item with an internal route, unless you have configured to overwrite the default access check, as mentioned in #4. This might be confusing for the most.

    I try to present you a solution which respects the default menu item access check and instead applies the role access check on top of it, when configured. Let me know, if this works for you as well.

  • Status changed to Needs review over 2 years ago
  • 🇩🇪Germany Daniel Kulbe Berlin

    Just fixing a tiny formatting issue with this update, no functional issues

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.2 & MySQL 8
    last update 11 months ago
    Patch Failed to Apply
  • Status changed to Needs work 9 months ago
  • 🇬🇧United Kingdom LiamPower

    No longer merges cleanly

  • 🇬🇧United Kingdom ocastle

    Re-rolled.

  • Status changed to Needs review 9 months ago
  • 🇬🇧United Kingdom ocastle
Production build 0.71.5 2024