0

I am using drupal 7, and I have created a custom module. This module consists of a form that can be used for adding records to the database. But I saw that the link to accessible to all the users, even anonymous users.

I want to restrict the access to this module and form from all the normal users; only the administrator users should access it.

I have created a role called Administrator and permitted my module only for the administrator. It still doesn't work.

How can I restrict the access to my custom module?

0
0

When you define the page the form is on via hook_menu(), you need to set the access rights via the "access callback" and "access arguments" settings.

The simplest way to do this is to provide an array containing a single permission value as the "access arguments" setting.

Not the answer you're looking for? Browse other questions tagged or ask your own question.