The devel module allows users with appropriate permission to switch to any other user on the site. During development/testing/debugging I use this very frequently. I have just set up SSO today and found that switch user no longer works from a client domain. Is it possible to redirect the switch user link to the controller domain?

CommentFileSizeAuthor
#4 devel-852446-switch-user.patch447 bytesYaron Tal

Comments

Isostar’s picture

I can confirm this bug

yonailo’s picture

+1 subscribing

yonailo’s picture

Hello, it works for me with the following code changes:

function devel_switch_user($name = NULL) {
  global $user;
  static $orig_user = array();

  if (isset($name)) {
    $global_sid = $user->global_sid;
    $user = user_load(array('name' => $name));
    $user->global_sid = $global_sid;
  }
  // Retrieve the initial user. Can be called multiple times.

The important thing is that if you use use_load to overwrite the global $user variable, the $user->global_uid is being lost and then you will need to revisit the controller, and you will end up reading the original user, somehow.

I do not know if this is the best solution, but you can try it on and report back if it worked for you too.

Yaron Tal’s picture

Status: Active » Needs review
StatusFileSize
new447 bytes

I made a patch version of the above and attached it. The patch worked on 2 installations with SSO here.

Edit:
Problem is, that $user->global_sid is only available when the SSO module is installed. I doubt this will ever make it into the devel module, even if an if(module_exists()) is added. Maybe a fix of some kind could be done in SSO to create a new session when the user object changed.