I have been bugged for some time by a problem with getting access denied messages when attempting to switch back. I had a look and it has to do with menu caching. Since the access property makes use of the $GLOBALS['masquerading'] for almost all of the menu items provided by the module they should not be cached. If the user has actually logged in recently and has a cached menu it will not have the masquerade menu items in it, making it impossible to switch back. I have attached a patch which fixes this. I figure that all of the other menu items using this GLOBAL should be non-cached as well. Perhaps the cache_clear_all at logout and switchback are an attempt to fix this and can now be removed as well?

Comments

zarko’s picture

Version: 7.x-1.x-dev » 5.x-1.x-dev

HEAD seems to still point to 1.15 of this filem so I suppose that this is a patch against 5.x-1.x-dev really.

melsawy’s picture

+1

amowafy’s picture

Version: 5.x-1.x-dev » 5.x-1.1
StatusFileSize
new1.89 KB

This patch for 5.x-1.1 but also for switching to user

btully’s picture

amowafy -

Thanks a bunch for this patch. I've applied it to 5.x-1.1 and it seems to fix the access denied bug like a charm. I can now actually switch back! Hopefully the author will include this patch in the next release as without it Masquerade becomes unusable.

cheers,
brian

Gurpartap Singh’s picture

Status: Needs review » Fixed

Thanks amowafy! But I did not include your changes to drupal_goto(), as it is unrelated to the issue; and works great as well.

Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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