Masquerade does what I want in the background. I just want to change the user interface a little and am happy to work on an add on module if needed.

I want to use the IP Login module to log people in to user accounts with a specific role. That role gives them the option to masquerade.

In the user interface, I would like to offer the standard login block to users who are already logged in and offer the standard logout block when they are logged in as someone else.

I am reading http://drupal.org/node/1171500 and will think about it to handle the role requirement.

The people with the masquerade role cannot login to users with the masquerade role.
Has anyone tried this?

Comments

I have the changes working. I add a role to indicate users who can masquerade and that lets us replace the Drupal login block with the Masquerade login block. I then add a role of Masquerade so the Drupal login block can be switched back on when people are masquerading. That lets them use the standard Drupal logout to leave the masqueraded account.

The original login is from the IP login module and I enhanced IP login to add the role named IP login. The Masquerade block is then set to display only for the IP login role. The Drupal user menu block is set to display when the role is !IP login or is (IP login and Masquerade). Using roles also lets us control other attributes.

Oh and I added password to the Masquerade login block so the login can be handed to anyone and they can only login as themselves.

Your changes make Masquerade EXACTLY what I've been searching for! I can't tell you how pleased I am to find these notes. Do you have these changes as a patch, or have they been incorporated into the module? I'm looking to set up Masquerade, with your added functionality, on a Drupal 6 installation. Thanks for your time on this project.

Status:Needs work» Active
StatusFileSize
new13.11 KB

Hello skandalfish, Here is a patch for 7.x-1.0-rc4. Contains lots of comments and watchdog things to trace the activity during testing. We will eventually clean out the watchdog stuff because the code is working. In most places, I retained the original code within comments and added my code after the comments.

** Use the next patch in #7. This one includes modifications to work with a heavily modified IP login. Drupal.org does not have an option to delete attachments when editing a previous post. **

Status:Active» Needs work

The code in patch uses custom function calls... suppose this could be implemented in custom module

+++ masquerade.module Tue Jan 20 09:26:36 1970
@@ -5,6 +5,37 @@
+  $remove_name = 'IP login only';

no t()

+++ masquerade.module Tue Jan 20 09:26:36 1970
@@ -99,6 +134,14 @@
+  $items['log_in/%'] = array(

does not in module's namespace

+++ masquerade.module Tue Jan 20 09:26:36 1970
@@ -614,10 +734,18 @@
+    mja_login_imis_login_validate($form, $form_state);

wtf?

+++ masquerade.module Tue Jan 20 09:26:36 1970
@@ -839,4 +990,19 @@
+  if(function_exists('ip_login_add_role')) {

wtf?

Re: wtf? I presume is an abbreviation for What is This i Found? :-)
I added Masquerade to a site using the IP Login module and had to customise the code to not clash with a similar feature I added to IP Login. When I clean up the Masquerade change, I will do something with that extra code to isolate it.

Same patch with a heap of unrelated junk removed. I cannot test it as I do not have a version of the system available without the other modules.

Part of the change was to move the mask info to the session to stop conflict with other modules. The project includes a string of modules fiddling with the user. Testing a change to the user was too complicated. There were some clashes. Changing the session is easier.

Status:Active» Needs work

One thing that could be done in the future is to make the role optional and selectable in Admin.