Hi,

just wondering if anyone knows the logic behind not being allowed to masquerade when the site is in offline mode. I sometimes use offline mode during development and masquerading then would be practical.

Cheers,

Albert.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dman’s picture

Well, a quick answer would be that:
- when offline, the role you masquerade as would not be able to see anything.
So, um, it's being authentic as to what you can and cannot do. That's the logic.

I do see the reason for your feature request though. It would be a bit of a twist - behave like that user except for this extra condition which overrides the true masquerade behavior. Not sure what it would take to built special cases like that in though. In this case it would be useful.
It may be that offline mode is detected before masquerade ever bootstraps. Basic offline mode is admin-or-nobody.
Dunno really, but I can see why it's like this at the moment.

alberto56’s picture

@dman thanks for your answer, makes total sense. I was thinking of an "exception", but maybe it wouldn't be that elegant a solution.

alberto56’s picture

Category: support » feature

when offline, the role you [are] masquerade as would not be able to see anything.

Well, not really, users other than user 1 can access the site even when it is offline. Here is my specific usecase:

  • My site is offline during development so no one stumbles upon it by mistake.
  • I have two roles, developer and editor
  • Apart from user 1, I have a user "developer" (being of the role developer) and a user "editor" (of role editor)
  • As user 1, I want to make sure wysiwyg functionality works for the editor role but not the developer role.
  • I can log out and log back in as developer or editor for testing, but because I am offline, I can't use masquerade for this.

So, I don't see there being an exception here. I am curious as to why masquerade is incompatible with Offline mode.

alberto56’s picture

Another note on this: Devel's "Switch User" block allows you to switch users even when offline.

Devel's Switch User is much like Masquerade but I prefer the later because Switch User doesn't allow you to switch to the anonymous User.

Of course, maybe it is that functionality (switching to the anonymous user) which just doesn't make sense in Offline mode, because you wouldn't see anything. How about just preventing one from masquerading as anonymous in Offline mode, but allowing masquerading as any other user?

deviantintegral’s picture

Version: 6.x-1.3 » 6.x-1.x-dev
Status: Active » Needs review
FileSize
2.11 KB
77.35 KB

Drupal 6 allows for any user with the "administer site configuration" permission to view the site while offline. You could give that permission to anonymous users... but that's not recommended for obvious reasons.

I've attached a patch which fixes a bug in that the API allows for appropriate users to switch while offline. I've also updated the error message text to indicate which users can switch while offline.

alberto56’s picture

Status: Needs review » Reviewed & tested by the community

Nice patch! I tested it on my site and it works perfectly. The error message is a lot clearer like this because it's far from obvious that the "administer site configuration" is required to view the site in offline mode.

Cheers,

Albert.

alberto56’s picture

Title: Why can't I masquarade in offline mode? » In offline mode, make it possible to masquerade as users with the "administer site configuration" permission
deviantintegral’s picture

Here is a patch against HEAD. I'll be committing both of these in a moment.

deviantintegral’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

  • Commit 52c633f on master, 8.x-2.x, 8.x-2.x-admin-menu, 8.x-1.x-1836516 by deviantintegral:
    #811560 by deviantintegral, alberto56: Allow masquerading in offline...

  • Commit 52c633f on master, 8.x-2.x, 8.x-2.x-admin-menu, 8.x-1.x-1836516 by deviantintegral:
    #811560 by deviantintegral, alberto56: Allow masquerading in offline...