0

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 Answers2

2

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.

Sumoanand
  • 8,835
  • 2
  • 47
  • 46
  • Thanks! Even though I knew this, your answer made me go back and discover a stupid typo that I had looked over 100 times before. *Blush* – user2557662 Jul 08 '13 at 11:12
0

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

Community
  • 1
  • 1
Mihir Patel
  • 53
  • 1
  • 6
  • I think my problem is different, or I did not understand the answer... I created the table using phpMyAdmin, and the module does access the database when I log in as administrator, but gives "access denied" when loggied in as authenticated user. – user2557662 Jul 07 '13 at 12:57