Generalize masquerade_target_user_access() to allow checks for any user, not just current user

Created on 5 June 2025, about 23 hours ago

Problem/Motivation

I want to create a form where I can list the users that can masquerade as a specific target user. However, masquerade_target_user_access() only has a parameter for the target user, and it assumes that I want to check the current user's access. This means I would need to copy the code into a custom function to allow checking for a different user.

Steps to reproduce

masquerade_target_user_access() doesn't have a parameter for user to check access for.

Proposed resolution

It would be simple to add a parameter and have it default to the current user if no value is passed.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024