Hello, I think it would be a nice feature if there could be a relative option. I mean masquerade not just as any user who is marked as "masqueradeable" but only as the users who have a connection or relation with the main user. It would be a way to make aliases.
So there would be 3 permissions masquerade as admin absolute, masquerade as admin relative and masquerade as user.
Relations could be made with user realtions module other user alias.
What do you think?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

deviantintegral’s picture

I've started to implement this feature as I need it for a client. I'm currently implementing it so it doesn't use any other modules, but I'm going to write the functionality so it could easily be extended to support other sources of user lists.

Right now, it's just going to have an auto-complete text field in the user edit page to allow specifying the users a user is able to switch to. I plan on posting a starting patch in the next day or so.

deviantintegral’s picture

Status: Active » Postponed
FileSize
10.97 KB

Here is a patch. It doesn't completely work at the moment due to the issue over at #521444: Store user ID's instead of user names for quick switch links.

It works by adding an autocomplete field to each user's edit page, where administrators can enter user names able to be switched to. The users are then automatically added to the "quick switch" list.

I have a patch against 6.x-1.1 if anyone is interested, though it will break updates a bit down the line due to install hooks being added in the -dev release.

deviantintegral’s picture

About integration for other modules; I think the best solution is to add a hook which other modules can implement. How about a hook like the following?

hook_masquerade_user_switch($account = NULL);

Modules would be expected to return an array of user_from => user_to pairs. If $account is NULL, return pairs for all allowed users, otherwise return only for the specific account object.

deviantintegral’s picture

A hook issue is all ready open at #324292: Adding hooks into Masquerade, so I'm going to keep this patch to be without the hook.

deviantintegral’s picture

Status: Postponed » Needs review
FileSize
11.34 KB

Here is a reroll of this patch now that #521444: Store user ID's instead of user names for quick switch links has landed.

deviantintegral’s picture

Here is a re-rolled patch against the latest version. Only major differences are the change to $_SESSION.

Unless anyone posts any issues with this, I'll probably commit it later tonight.

deviantintegral’s picture

Status: Needs review » Fixed

I've committed this.

Status: Fixed » Closed (fixed)

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