Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Combined with #1364574: Invoke logout & login hooks for compatibility with bakery, the forthcoming patch will allow bakery and masquerade to coexist on the same site.
Comment | File | Size | Author |
---|---|---|---|
#9 | bakery-masquerade-1599522-9.patch | 1.65 KB | btopro |
#4 | 1599522.patch | 1.46 KB | drumm |
#1 | 1599522.patch | 1.45 KB | drumm |
Comments
Comment #1
drummHere is the patch. It has been tested on Drupal.org dev sites.
Comment #2
gregglesSeems rtbc to me.
Comment #3
drummIt was also tested on the Munich live site.
Comment #4
drummHere is an updated patch. It rebased cleanly, only line number changes.
Comment #5
coltraneIf the user doesn't have the bypass bakery permission this will still log those users out.
I am able to get it to work sometimes for users without that permission but the masquerade ability of returning to the original user doesn't work. Putting back to CNW to look into whether there's a better way to do this.
Comment #6
drummI took another look at our usage on DrupalCon sites, the only ones where we had allowed masquerade, and I'm not sure that we need this.
Comment #7
MrDaleSmith CreditAttribution: MrDaleSmith commentedDeveloping a site where Masquerade and Bakery were a client requirement, and we had to apply the patch in #4 to get both working together.
Comment #8
MrDaleSmith CreditAttribution: MrDaleSmith commentedFor some reason, the patch in #4 stopped being effective recently.
For anyone looking to get these two modules working together, we eventually used the experiment rules integration in Masquerade Extras (after applying the patch to Masquerade here) and then created a custom rule to handle users who were masquerading getting the correct bakery credentials.
Comment #9
btopro CreditAttribution: btopro commentedRe rolled against dev and I think I fixed the issue that was introduced / mentioned. I had to integrate with Masquerade before for an internal authentication method (cosign) that was really aggressive as to how it integrated with drupal (not unlike bakery). The issue is that your account doesn't have the ability to skip logout, you are masquerading which alters your session / cookie token, and as you are in the process of "logging in" you get logged out.
The way around this is to set a value in the masquerade form that indicates the user account is about to masquerade. You write this into the form to fire prior to the masquerade form submission being processed. It kicks you over to login / a new page load after it has switched your account to the new user. It notices the "about to masquerade" property on your user account and prevents it from killing the request.
I've tested this for all of 5 minutes and it appears to be working on the site you masquerade with. Obviously once you switch to another site it doesn't know you were masquerading and so your session gets dumped on other services (or could be).