Currently

Initiating masquerade: "User DestinationUser masqueraded as DestinationUser."
Terminating masquerade: "User SourceUser stopped masquerading as SourceUser."

Must be

Initiating masquerade: "User SourceUser masqueraded as DestinationUser."
Terminating masquerade: "User SourceUser stopped masquerading as DestinationUser."

Problem

Variable $account is changed by ...->setAccount();

$account = $this->currentUser;
...
$this->currentUser->setAccount($new_user);
...
$this->logger->info(..., $account->getDisplayName() );

Solution

- $account = $this->currentUser;
+ $account = $this->currentUser->getAccount();
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ragnarkurm created an issue. See original summary.

ragnarkurm’s picture

ragnarkurm’s picture

andypost’s picture

Status: Active » Needs review
hgoto’s picture

Status: Needs review » Reviewed & tested by the community

I tested the patch #2 and I confirmed it fixes the issue. It's simple and I'd like to move this to RTBC.

The following is off-topic. How about changing the variable name for more code readability? For example, in the method switchTo(), the variable $account means the original account that going to masquerade another user. So $original_account is more easy-to-understand name than account, I think. But this may be against the policy or something. I'd like to hear other opinion.

  • andypost committed 416682a on 8.x-2.x authored by ragnarkurm
    Issue #2743333 by ragnarkurm: Invalid message on initiating and...
andypost’s picture

Status: Reviewed & tested by the community » Fixed

Thanx, commited and pushed!

@hgoto Please file new issue, I think $target_account is nicely describes the target of the function but probably better to extend code comments and change local variable names - suggestions are welcome in separate issue)

hgoto’s picture

@andypost, thank you for your reaction. I see. I understood! I'll file a new issue.

Status: Fixed » Closed (fixed)

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