Problem/Motivation

When I am logged in as an administrator, I cannot access the Bean overview page. The error message is "Access denied, You are not authorized to access this page". My first step was to look at the permissions page and indeed the "Access the Bean overview page" was checked. So, I started to debug and run some traces.

In the bean.module, the hook_menu() entry is:

$items['admin/content/blocks'] = array(
    'title' => 'Blocks',
    'description' => 'Manage blocks used on your site.',
    'page callback' => 'bean_list',
    'access arguments' => array('access bean overview'),
    'file' => 'includes/bean.pages.inc',
    'type' => MENU_LOCAL_TASK | MENU_NORMAL_ITEM,
  );

My assumption was 'access callback' equaled 'user_access'. Not so. When admin_views is enable, /admin/content is overridden and the 'views_access' callback is used/inherited(?) instead. See the debug session below:

bean overview page trace

Disabling admin_views verified the use of 'user_access' once again. I also tested this by leaving admin_views enabled and adding the following to the hook_menu() entry:

'access callback' => 'user_access',

again, all good.

Proposed resolution

My solution was to add a 'access callback' to the hook_menu() entry.

  $items['admin/content/blocks'] = array(
    'title' => 'Blocks',
    'description' => 'Manage blocks used on your site.',
    'page callback' => 'bean_list',
    'access callback' => 'user_access',
    'access arguments' => array('access bean overview'),
    'file' => 'includes/bean.pages.inc',
    'type' => MENU_LOCAL_TASK | MENU_NORMAL_ITEM,
  );

Remaining tasks

  1. Post patch.
  2. Review solution.
  3. If solution accepted, test patch.
  4. Merge into dev branch.

User interface changes

None.

API changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rojosnow’s picture

rojosnow’s picture

Issue summary: View changes