Limit to relative users

DaniOrama - August 2, 2008 - 11:02
Project:Masquerade
Version:6.x-1.x-dev
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

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?

#1

deviantintegral - July 15, 2009 - 00:59

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.

#2

deviantintegral - July 16, 2009 - 17:43
Status:active» postponed

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.

AttachmentSize
290313_limit_to_relative_users_6.x.patch 10.97 KB

#3

deviantintegral - July 16, 2009 - 17:49

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.

#4

deviantintegral - August 6, 2009 - 02:02

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.

#5

deviantintegral - August 6, 2009 - 20:24
Status:postponed» needs review

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

AttachmentSize
290313_limit_to_relative_users_6.x_5.patch 11.34 KB

#6

deviantintegral - August 28, 2009 - 19:54

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.

AttachmentSize
290313_limit_to_relative_users_6.x_6.patch 11.31 KB

#7

deviantintegral - August 31, 2009 - 17:27
Status:needs review» fixed

I've committed this.

#8

System Message - September 14, 2009 - 17:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.