Problem/Motivation

when I click the “moderation dashboard” it seems to be linking to someone else’s UserID:
example – I masqueraded as user A who has a userID of 1566. But when I hover over the “Moderation Dashboard” link, I can see it’s pointing to /user/3636/moderation-dashboard:

So, it shows an “Access Denied” error since that’s the wrong userID.

It might be cache related. I flushed the cache and it helped with one user but not others.

Steps to reproduce

Use Masquerade module
Masquerade to different user
Click on Moderation Dashboard, you will see in URL user id is different

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Shani Maurya created an issue. See original summary.

shani maurya’s picture

StatusFileSize
new1.53 KB

Adding patch to solve the above issue

shani maurya’s picture

Assigned: shani maurya » Unassigned
Status: Active » Needs review
smustgrave’s picture

Tried replicating following the IS but I'm getting the write dashboard. What cache modules are you using

shani maurya’s picture

This issue comes when I'm using the Masquerade module. I'm not using any caching module.

smustgrave’s picture

Don't know if they're related but does #3342189: Access check fails on user profile page solve this by chance?

smustgrave’s picture

Status: Needs review » Postponed (maintainer needs more info)

For the answer in #6

bluegeek9’s picture

Status: Postponed (maintainer needs more info) » Active

I think I ran into the same problem. My users have reported the link to the moderation dashboard takes them to the wrong page. I had trouble reproducing the issue, but I saw a user experiencing the problem.

I believe it is a problem with the cache. The users having the issue all have the same permissions.

         '#cache' => [
           'contexts' => ['user.permissions'],
        ]

I think this will fix the problem; every user has a different user id. I will report back what I find.

         '#cache' => [
           'contexts' => ['user'],
        ]
bluegeek9’s picture

StatusFileSize
new428 bytes

Patch.

bluegeek9’s picture

Title: URL gets random user id after user is masqueraded » Toolbar links to wrong user's dashboard
Status: Active » Needs review

sahil.goyal’s picture

I masqueraded as a different user and attempted to access the Moderation Dashboard. I noticed that it correctly directed me to the appropriate URL and displayed the correct user's information. I did not encounter any "Permission denied" errors during this process.
For example, when I masqueraded as user/2 and clicked on the Moderation Dashboard link, I was redirected to the URL /user/2/moderation-dashboard. I conducted these tests using the Moderation Dashboard version 2.1.1 in Drupal version 10.1.x-dev.
Based on my observations, it seems that the reported issue is not reproducible with the given configuration and steps.
If encounter any specific scenarios or steps that consistently lead to the "Permission denied" error, please provide additional details.

  • bluegeek9 authored 0b4f63d6 on 2.0.x
    Issue #3331940 by Shani Maurya: URL gets random user id after user is...
smustgrave’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.