After updating to rc7, I can no longer masquerade as the Anonymous User even if I have the 'masquerade as any user' permission.

I still have yet to learn how to create a patch file, but I add the following lines of code to the masquerade_block_1_validate function:

  $to_uid = db_select('users', 'u')
    ->fields('u', array('uid'))
    ->condition('u.name', $name, '=')
    ->execute()
    ->fetchField();
+  if ($name == variable_get('anonymous',t("Anonymous"))) {  //Added 3 lines starting at line 662
+    $to_uid = 0;                                                           
+  }
  if ($to_uid !== FALSE) {
    $allowed = user_access('masquerade as any user') ||
               db_select('masquerade_users', 'm')
                  ->fields('m', array('uid_to'))
                  ->condition('m.uid_to', $to_uid, '=')
                  ->condition('m.uid_from', $user->uid, '=')
                  ->execute()
                  ->fetchField();
  }

This allows for masquerading as Anonymous.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cs_shadow’s picture

Status: Active » Needs review
FileSize
549 bytes

Attaching a patch as suggested in the description though not sure if this is the best way to fix this.

(@swamiman: Its fairly easy to make a patch. You can refer this documentation for the same if you wish: https://drupal.org/node/707484)

deekayen’s picture

Status: Needs review » Closed (won't fix)

Perhaps I need to be more blunt about this issue, since the request keeps popping up. If you want to test anonymous, log out. The solution to doing anonymous masquerading isn't as simple as 3 lines of code.

swamiman’s picture

Priority: Major » Normal

Forgive me for assuming that anonymous masquerading was part of the code. Prior to rc7 it was available. I used it, but if it wasn't suppose to happen, my mistake. I suggest that the anonymous user be removed from the masquerade autocomplete options.

spidersilk’s picture

This all seems a little strange, because masquerading as Anonymous was always possible before... I'm curious as to why it suddenly became impossible with rc7.

RaulMuroc’s picture

Status: Closed (won't fix) » Active

The same here with rc7 version no possibility to masquerade anonymous user.

deekayen’s picture

Status: Active » Closed (won't fix)

Masquerading as anonymous hasn't always worked. It depends on who the maintainer of the week is. 8.x won't support anonymous masquerading. Just logout if you want to be anonymous.

RaulMuroc’s picture

Then this module has almost no sense because 90% of time what annoys us (Developers) is to Logout to see theming issues, css....

Is not a complain, is only to be aware that possibly this module will lose users if doesn't support Anonymous Masquerade. Me, the first who stops use it for now :S

alexverb’s picture

Status: Closed (won't fix) » Active

Why not have a constructive discussion about this legitimate feature request instead of saying "just logout"? The biggest usage of this module is people doing role testing. As it happens to be, anonymous is a role and deserves to be supported by masquerade.

We don't actually care how difficult it may be to incorporate this functionality. If you lay out the problems for us we can try helping overcome those difficulties.

nvahalik’s picture

Status: Active » Closed (won't fix)

I'd like to add that now most browsers have a private browsing function and you're not even required to log out. Just create a private browsing window and do whatever you need.

Closing again, given that the request was already closed twice.