Update log messages to reflect that a user was masquerading

Created on 15 October 2014, over 10 years ago
Updated 27 January 2025, 4 months ago

Update log messages to reflect that a user was masquerading

Problem/Motivation

Log messages don't currently reflect that the action was taken by a user masquerading as another user. This makes it impossible to determine which actions were actually performed by the logged user.

Steps to reproduce

  1. Log in as user 1 in browser 1
  2. Create basic page as user 1
  3. Log in as user 2 in browser 2 and masquerade as user 1
  4. As user 2 masquerading as user 1, edit the basic page created in step 2
  5. As user 1, edit the basic page created in step 2

Proposed resolution

Prepend "(Masquerading user: @user)" to the end of each log message generated while a user is masquerading.

Remaining tasks

Confirm resolution, review patch and commit.

Original report by deekayen

Since Masquerade keeps track of who the original user was to be able to switch back, and since watchdog() invokes hook_watchdog(), it seems like it should be possible for logged events to record the original user instead of the masqueraded user to maintain accountability.

✨ Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States deekayen Earth

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

Production build 0.71.5 2024