I would like to define more permissions on each submission result local menu tab ie analysis, download, table

Here is my custom module, first implement hook_permission to define new user permission and then implement hook_menu_alter to override existing access callback

function webform_custom_permission() {
  return array(
    'access webform results analysis' => array(
       'title' => t('Access webform results analysis'),
       'description' => t('Grants access to the "Results analysis" tab'),
    ),
    'access webform results download' => array(
       'title' => t('Access webform results download'),
       'description' => t('Grants access to the "Results download" tab'),
    ),
  );
}

function webform_custom_menu_alter(&$items) {
  $items['node/%/webform-results/download']['access callback'] = 'user_access';
  $items['node/%/webform-results/download']['access arguments'] = array('access webform results download');
}

I checked the new permission for a test user on admin/people/permissions
however the download local tab still no show.

What I am missed ?

Comments

quicksketch’s picture

Status: Active » Fixed

Look at the hook_menu() entry for webform.module. The menu paths aren't located at node/%/webform-results/download, they're at node/%webform_menu/webform-results/download. You could also dsm($items) in your hook_menu_alter() using devel.module to look at the list of menu items available. Right now it looks like you're modifying a non-existent menu item.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

typo