When you're an anonymous user, the Masquerade block can take between 500ms and 1 second to figure out if the anonymous user has access to masquerade. Since anonymous users should not be able masquerade ever, we should exist out early perhaps?

Comments

japerry created an issue. See original summary.

japerry’s picture

Title: Masquerade block should exist early for anonymous users » Masquerade block should exit early for anonymous users
andypost’s picture

Good point! I guess you mean s/exist/exit

  • andypost committed 994fb40 on 2880908-speed-up-block
    Issue #2880908: Masquerade block should exit early for anonymous users
    
andypost’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new842 bytes

probably it needs test cos removal of context but looks forbidden does not need this context it will be added only when block supposed to be rendered

Attaching patch cos module branches does not work well now

andypost’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests +ContributionWeekend2020
StatusFileSize
new2.56 KB

Added test and improved comment

andypost’s picture

StatusFileSize
new725 bytes
new2.33 KB

Reverted cache context to decide on it in #2900413: Allow UnMasquerade link in the "Masquerade" block

andypost’s picture

StatusFileSize
new549 bytes
new2.31 KB

And the last polishing

  • andypost committed 395ecc0 on 8.x-2.x
    Issue #2880908: Masquerade block should exit early for anonymous users
    
andypost’s picture

Status: Reviewed & tested by the community » Fixed

Fixed

Status: Fixed » Closed (fixed)

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

dunebl’s picture

Before this commit I was using (a lot) the masquerade feature even for anonymous user on my DEV site.
It is very handy because it allows me to test several user profiles very quickly.

The permission to display the masquerade block for anonymous users can be set in the permission page.
After this commit, setting the permission for anonymous user doesn't work anymore which is bad.
I think that we can revert this commit to provide more flexibility.

andypost’s picture

That's sounds strange, DuneBL, because masquerade as anonymous user is not supported starting from d7 (project page points about it - use private browsing or log off)

dunebl’s picture

@andypost: I don't know what to say... It was working as I said until I update the module 2 days ago...