0
votes

I am developing a Drupal 7 module. I have created a table in the drupal database for that module directly in phpMyAdmin. I have set te permissions for that module to be viewed by authenticated users. The module works fine when I log in as an administrator. But it gives "access denied" when I log in as the authenticated user.

Anyone any suggestions how I can also give authenticated users access? Thanks!

2

2 Answers

2
votes

Probably, the issue is in the menu hook. Please check its access argument.

It should be something like this:

  $items['abc-url'] = array(
    'title' => 'Page abc',
    'page callback' => 'page_abc',
    'type' => MENU_CALLBACK,
    'access arguments' => array('access abc'),
    'file' => 'my_module.admin.inc',
  );

Then you need to define it(in Drupal 7 like following):

function my_module_permission() {
  return array(
    'access abc' => array(
      'title' => t('Access abc'),
      'description' => t('This will provide permission to abc.'),
    ),
  );
}

Then clear the cache, go to user permissions page & give authenticated user permission to "Access abc".

Hope this will help.

0
votes

You need to add list of users to datatbase permission property whom you wants to allow access.

Check this link. MySQL: Grant **all** privileges on database