I'm creating my first D7 module and the last major step is creating custom permissions. I've uninstalled and reinstalled the module, and cleared all caches numerous times. I first assumed I would just need the hook_permission() function to enable the display of the "Permissions" link in the module install page. I then added the permission to one of the menu pages in case that was also required to trigger the display. Still nothing. I don't see any obvious typos. Is there another hook that I need to be able to configure? The access restriction seems to be working in one way or another because after making this change, I am unable to access the page.

function ledger_reports_menu() {
  $items = array();

  $items['ledger/reports'] = array(
    'title' => 'Ledger Reports',
    'description' => 'List of available reports',
    'page callback' => 'ledger_reports_page',
    'access callback' => TRUE,
    'weight' => 10,
  );

  $items['ledger/reports/balance-sheet'] = array(
    'title' => 'Test Balance Sheet',
    'description' => 'The current balance of all asset, equity, and liability accounts',
    'page callback' => 'ledger_reports_balance_sheet',
    'page arguments' => array(3),
    'access callback' => array('view ledger reports'),
    'weight' => 10,
  );
  return $items;
}

/**
 * Implements hook_permission().
 */
function ledger_reports_permisssion(){
  return array(
    'view ledger reports' => array(
      'title' => t('View Ledger Reports'),
      'description' => t('View the accounting reports.'),
    ),
  );
}

Comments

beakerboy’s picture

it turns out permission does not, in fact, have 3 s's