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?

Support from Acquia helps fund testing for Drupal Acquia logo

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
FileSize
842 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

Added test and improved comment

andypost’s picture

andypost’s picture

FileSize
549 bytes
2.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...