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.
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.
Comment | File | Size | Author |
---|---|---|---|
#8 | 811560_offline_permission_7.x_8.patch | 2.5 KB | deviantintegral |
#5 | Users | localhost.png | 77.35 KB | deviantintegral |
#5 | 811560_offline_permission_5.patch | 2.11 KB | deviantintegral |
Comments
Comment #1
dman CreditAttribution: dman commentedWell, 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.
Comment #2
alberto56 CreditAttribution: alberto56 commented@dman thanks for your answer, makes total sense. I was thinking of an "exception", but maybe it wouldn't be that elegant a solution.
Comment #3
alberto56 CreditAttribution: alberto56 commentedWell, not really, users other than user 1 can access the site even when it is offline. Here is my specific usecase:
So, I don't see there being an exception here. I am curious as to why masquerade is incompatible with Offline mode.
Comment #4
alberto56 CreditAttribution: alberto56 commentedAnother 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?
Comment #5
deviantintegral CreditAttribution: deviantintegral commentedDrupal 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.
Comment #6
alberto56 CreditAttribution: alberto56 commentedNice 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.
Comment #7
alberto56 CreditAttribution: alberto56 commentedComment #8
deviantintegral CreditAttribution: deviantintegral commentedHere is a patch against HEAD. I'll be committing both of these in a moment.
Comment #9
deviantintegral CreditAttribution: deviantintegral commented