An HTTP error 403 occurred.
http://www.sitename.com/flag/flag/hotel_flag/38?destination=entityform/3...

I've that bug i don't know why , maybe someone can help me ?

Comments

spelcheck’s picture

Issue summary: View changes

What I've found is that if 'view published content' isn't checked for a particular role, that role will get 403 when trying to use flags. I'm running into the same issue, though mine is a flag using the User entity. I was hoping 'view published content' wouldn't be necessary as it doesn't involve content, only users.

My usage for flag is to have essentially a user in a restricted role (not able to view published content) be able to flag another user as 'request a sponsor'. The user they flagged gets a notification of a Sponsor Request and then flags them back under another 'Sponsor this user' flag. This triggers escalation of roles so that the user can 'view published content'.

Maybe the developer could comment on this?

spelcheck’s picture

Workaround is to keep 'view published content' checked for that role, and instead use https://www.drupal.org/project/node_view_permissions to limit viewing permissions for every content type individually.

joachim’s picture

Component: Miscellaneous » Flag core

Confirming this.

The problem is that the paths for flagging don't take this possibility into account:

  $items['flag/%/%flag/%'] = array(
    'title' => 'Flag',
    'page callback' => 'flag_page',
    'page arguments' => array(1, 2, 3),
    'access callback' => 'user_access',
    'access arguments' => array('access content'),
    'file' => 'includes/flag.pages.inc',
    'type' => MENU_CALLBACK,
  );
joachim’s picture

Title: Error 403 » Access to (un)flagging pages is controled by 'access content' permission
Status: Active » Needs review
StatusFileSize
new1.32 KB

Here's a patch. Let's see what the testbot says.

joachim’s picture

Status: Needs review » Fixed

Testbot happy, so let's go with this.

  • joachim committed 03c3015 on 7.x-3.x
    Issue #1902006 by joachim: Fixed access to (un)flagging pages is...

Status: Fixed » Closed (fixed)

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