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?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | masquerade-7.x-1.0-rc4.add_role.patch | 13.11 KB | peterx |
| #7 | masquerade-7.x-1.0-rc4.add_role_cleaned_up.patch | 2.52 KB | peterx |
Comments
Comment #1
peterx commentedI 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.
Comment #2
peterx commentedOh and I added password to the Masquerade login block so the login can be handed to anyone and they can only login as themselves.
Comment #3
skandalfish commentedYour 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.
Comment #4
peterx commentedHello 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. **
Comment #5
andypostThe code in patch uses custom function calls... suppose this could be implemented in custom module
no t()
does not in module's namespace
wtf?
wtf?
Comment #6
peterx commentedRe: 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.
Comment #7
peterx commentedSame 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.
Comment #8
peterx commentedOne thing that could be done in the future is to make the role optional and selectable in Admin.
Comment #9
ressaThanks for working on this. In an attempt to help the maintainers, I am going through some of the Drupal 7 issues, and closing them, since Drupal 7 is EOL.
Maintainers should grant credit for the great work to the relevant users, even if the patch did not get committed: https://www.drupal.org/docs/develop/issues/issue-procedures-and-etiquett....
Since Drupal 7 is EOL, we can probably close this issue, but feel free to re-open if this is still relevant, and we should consider adding this to the Drupal 11 version?